Temporary Drag Region Compatibility#577
Conversation
|
Great idea! Your solution may actually be a webui standard, but instead of element ID CSS: #titlebar {
-webkit-app-region: drag; /* Webkit Standard */
--webui-app-region: drag; /* WebUI Alternative */
}TypeScript: let target = e.target as HTMLElement;
while (target) {
const computedStyle = window.getComputedStyle(target);
const webkitRegion = computedStyle.getPropertyValue("-webkit-app-region").trim();
const webuiRegion = computedStyle.getPropertyValue("--webui-app-region").trim();
if (webkitRegion === "drag" || webuiRegion === "drag") {
this.#initialMouseX = e.screenX;
this.#initialMouseY = e.screenY;
this.#initialWindowX = this.#currentWindowX;
this.#initialWindowY = this.#currentWindowY;
this.#isDragging = true;
break;
}
target = target.parentElement;
}If you see |
|
Thanks for the suggestion! I'll take a closer look later today and re-open a PR if appropriate. |
I’ve rewritten the implementation based on your suggestion — please refer to PR #579. Since this PR is no longer needed, I’ll go ahead and close it. Thanks again! |
Added a temporary workaround for
--webkit-app-region.For those platforms without this feature, by setting the element id to
webui-draggable,can simulate the behavior of it, thus providing some compatibility.