diff options
Diffstat (limited to 'modules/drawers/Interactions.qml')
| -rw-r--r-- | modules/drawers/Interactions.qml | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml index 99aa267..84714b5 100644 --- a/modules/drawers/Interactions.qml +++ b/modules/drawers/Interactions.qml @@ -82,6 +82,8 @@ CustomMouseArea { const x = event.x; const y = event.y; + const dragX = x - dragStart.x; + const dragY = y - dragStart.y; // Show bar in non-exclusive mode on hover if (!visibilities.bar && Config.bar.showOnHover && x < bar.implicitWidth) @@ -89,33 +91,68 @@ CustomMouseArea { // Show/hide bar on drag if (pressed && dragStart.x < bar.implicitWidth) { - const dragX = x - dragStart.x; if (dragX > Config.bar.dragThreshold) visibilities.bar = true; else if (dragX < -Config.bar.dragThreshold) visibilities.bar = false; } - // Show osd on hover - const showOsd = inRightPanel(panels.osd, x, y); + if (panels.sidebar.width === 0) { + // Show osd on hover + const showOsd = inRightPanel(panels.osd, x, y); - // Always update visibility based on hover if not in shortcut mode - if (!osdShortcutActive) { - visibilities.osd = showOsd; - root.panels.osd.hovered = showOsd; - } else if (showOsd) { - // If hovering over OSD area while in shortcut mode, transition to hover control - osdShortcutActive = false; - root.panels.osd.hovered = true; - } + // Always update visibility based on hover if not in shortcut mode + if (!osdShortcutActive) { + visibilities.osd = showOsd; + root.panels.osd.hovered = showOsd; + } else if (showOsd) { + // If hovering over OSD area while in shortcut mode, transition to hover control + osdShortcutActive = false; + root.panels.osd.hovered = true; + } + + const showSidebar = pressed && dragStart.x > bar.implicitWidth + panels.sidebar.x; + + // Show/hide session on drag + if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { + if (dragX < -Config.session.dragThreshold) + visibilities.session = true; + else if (dragX > Config.session.dragThreshold) + visibilities.session = false; + + // Show sidebar on drag if in session area and session is nearly fully visible + if (showSidebar && panels.session.width >= panels.session.nonAnimWidth && dragX < -Config.sidebar.dragThreshold) + visibilities.sidebar = true; + } else if (showSidebar && dragX < -Config.sidebar.dragThreshold) { + // Show sidebar on drag if not in session area + visibilities.sidebar = true; + } + } else { + const outOfSidebar = x < width - panels.sidebar.width; + // Show osd on hover + const showOsd = outOfSidebar && inRightPanel(panels.osd, x, y); + + // Always update visibility based on hover if not in shortcut mode + if (!osdShortcutActive) { + visibilities.osd = showOsd; + root.panels.osd.hovered = showOsd; + } else if (showOsd) { + // If hovering over OSD area while in shortcut mode, transition to hover control + osdShortcutActive = false; + root.panels.osd.hovered = true; + } + + // Show/hide session on drag + if (pressed && outOfSidebar && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { + if (dragX < -Config.session.dragThreshold) + visibilities.session = true; + else if (dragX > Config.session.dragThreshold) + visibilities.session = false; + } - // Show/hide session on drag - if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { - const dragX = x - dragStart.x; - if (dragX < -Config.session.dragThreshold) - visibilities.session = true; - else if (dragX > Config.session.dragThreshold) - visibilities.session = false; + // Hide sidebar on drag + if (pressed && inRightPanel(panels.sidebar, dragStart.x, 0) && dragX > Config.sidebar.dragThreshold) + visibilities.sidebar = false; } // Show launcher on hover, or show/hide on drag if hover is disabled @@ -123,7 +160,6 @@ CustomMouseArea { if (!visibilities.launcher && inBottomPanel(panels.launcher, x, y)) visibilities.launcher = true; } else if (pressed && inBottomPanel(panels.launcher, dragStart.x, dragStart.y) && withinPanelWidth(panels.launcher, x, y)) { - const dragY = y - dragStart.y; if (dragY < -Config.launcher.dragThreshold) visibilities.launcher = true; else if (dragY > Config.launcher.dragThreshold) @@ -143,7 +179,6 @@ CustomMouseArea { // Show/hide dashboard on drag (for touchscreen devices) if (pressed && inTopPanel(panels.dashboard, dragStart.x, dragStart.y) && withinPanelWidth(panels.dashboard, x, y)) { - const dragY = y - dragStart.y; if (dragY > Config.dashboard.dragThreshold) visibilities.dashboard = true; else if (dragY < -Config.dashboard.dragThreshold) |