macOS: make conversation and main header draggable

This commit is contained in:
Evan Hahn 2021-03-08 16:42:29 -06:00 committed by Josh Perez
parent ecc04d36de
commit 729d808f62
7 changed files with 119 additions and 11 deletions

View file

@ -0,0 +1,21 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export function isWindowDragElement(el: Readonly<Element>): boolean {
let currentEl: Element | null = el;
do {
const appRegion = getComputedStyle(currentEl).getPropertyValue(
'-webkit-app-region'
);
switch (appRegion) {
case 'no-drag':
return false;
case 'drag':
return true;
default:
currentEl = currentEl.parentElement;
break;
}
} while (currentEl);
return false;
}