macOS: make conversation and main header draggable
This commit is contained in:
parent
ecc04d36de
commit
729d808f62
7 changed files with 119 additions and 11 deletions
21
ts/util/isWindowDragElement.ts
Normal file
21
ts/util/isWindowDragElement.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue