fix: debounce toolbar display after dragging a window

This commit is contained in:
JohnBoulanger
2025-11-20 13:00:04 -05:00
parent bb90595431
commit 8fe3e2fff6
+22 -2
View File
@@ -1547,10 +1547,30 @@ async function UIDesktop(options) {
}, hideDelay);
};
// debounce timer to prevent toolbar showing immediately after drag ends
window.dragReleaseDebounceTimer = null;
const DRAG_RELEASE_DEBOUNCE_MS = 300;
// track when drag operations end to enable debounce
$(document).on('dragend', function() {
window.dragReleaseDebounceTimer = setTimeout(() => {
window.dragReleaseDebounceTimer = null;
}, DRAG_RELEASE_DEBOUNCE_MS);
});
// also debounce when mouseup occurs while in drag state
$(document).on('mouseup', function() {
if (window.a_window_is_being_dragged || window.an_item_is_being_dragged) {
window.dragReleaseDebounceTimer = setTimeout(() => {
window.dragReleaseDebounceTimer = null;
}, DRAG_RELEASE_DEBOUNCE_MS);
}
});
// hovering over a hidden toolbar will show it
$(document).on('mouseenter', '.toolbar-hidden', function () {
// if a window is being dragged, don't show the toolbar
if(window.a_window_is_being_dragged)
// if a window is being dragged or currently in drag release debounce period, don't show the toolbar
if(window.a_window_is_being_dragged || window.dragReleaseDebounceTimer !== null)
return;
// if selectable is active , don't show the toolbar