2021-03-08 22:42:29 +00:00
|
|
|
// 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 {
|
2021-11-11 22:43:05 +00:00
|
|
|
const appRegion =
|
|
|
|
getComputedStyle(currentEl).getPropertyValue('-webkit-app-region');
|
2021-03-08 22:42:29 +00:00
|
|
|
switch (appRegion) {
|
|
|
|
case 'no-drag':
|
|
|
|
return false;
|
|
|
|
case 'drag':
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
currentEl = currentEl.parentElement;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (currentEl);
|
|
|
|
return false;
|
|
|
|
}
|