From 5c8801ba764fffb1eeeb9242efaa68a7f3c2cce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Atoch?= Date: Sat, 8 Nov 2025 08:51:08 -0500 Subject: [PATCH] SmartPanel: Improved rolldown direction when the bar is not floating --- Modules/MainScreen/SmartPanel.qml | 50 ++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/Modules/MainScreen/SmartPanel.qml b/Modules/MainScreen/SmartPanel.qml index e4bda7a2..3d21b68d 100644 --- a/Modules/MainScreen/SmartPanel.qml +++ b/Modules/MainScreen/SmartPanel.qml @@ -744,12 +744,14 @@ Item { if (!isPanelVisible) { return true } + // PRIORITY 1: Bar attachment (always takes precedence) // Attached to bar at top if (willTouchTopBar) { return true } + // PRIORITY 2: Screen edge attachment (only if not touching bar) // Attached to screen top edge (not bar) - if (willTouchTopEdge && !willTouchTopBar) { + if (willTouchTopEdge && !willTouchTopBar && !willTouchBottomBar && !willTouchLeftBar && !willTouchRightBar) { return true } // If panel is not attached to any edge, animate from top by default @@ -762,12 +764,14 @@ Item { if (!isPanelVisible) { return false } + // PRIORITY 1: Bar attachment (always takes precedence) // Attached to bar at bottom if (willTouchBottomBar) { return true } + // PRIORITY 2: Screen edge attachment (only if not touching bar) // Attached to screen bottom edge (not bar) - if (willTouchBottomEdge && !willTouchBottomBar) { + if (willTouchBottomEdge && !willTouchTopBar && !willTouchBottomBar && !willTouchLeftBar && !willTouchRightBar) { return true } return false @@ -776,22 +780,25 @@ Item { if (!isPanelVisible) { return false } - // Don't animate from left if also touching top/bottom edge (priority: vertical over horizontal) - // Check directly instead of relying on other computed properties to avoid race conditions - var touchingTopBar = isPanelVisible && panelContent.allowAttachToBar && root.barPosition === "top" && !root.barIsVertical && Math.abs(panelBackground.targetY - (root.barMarginV + Style.barHeight)) <= 1 - var touchingBottomBar = isPanelVisible && panelContent.allowAttachToBar && root.barPosition === "bottom" && !root.barIsVertical && Math.abs(panelBackground.targetY - (root.height - root.barMarginV - Style.barHeight - panelBackground.targetHeight)) <= 1 - var touchingTopEdge = isPanelVisible && panelContent.allowAttach && panelBackground.targetY <= 1 - var touchingBottomEdge = isPanelVisible && panelContent.allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1) - - if (touchingTopEdge || touchingBottomEdge || touchingTopBar || touchingBottomBar) { + // PRIORITY 1: Bar attachment (always takes precedence) + // If touching any horizontal bar, don't animate from left + if (willTouchTopBar || willTouchBottomBar) { return false } // Attached to bar at left if (willTouchLeftBar) { return true } + // PRIORITY 2: Screen edge attachment (only if not touching any bar) + // Don't animate from left if also touching top/bottom edge (priority: vertical over horizontal) + var touchingTopEdge = isPanelVisible && panelContent.allowAttach && panelBackground.targetY <= 1 + var touchingBottomEdge = isPanelVisible && panelContent.allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1) + + if (touchingTopEdge || touchingBottomEdge) { + return false + } // Attached to screen left edge (not bar) - if (willTouchLeftEdge && !willTouchLeftBar) { + if (willTouchLeftEdge && !willTouchLeftBar && !willTouchTopBar && !willTouchBottomBar && !willTouchRightBar) { return true } return false @@ -800,22 +807,25 @@ Item { if (!isPanelVisible) { return false } - // Don't animate from right if also touching top/bottom edge (priority: vertical over horizontal) - // Check directly instead of relying on other computed properties to avoid race conditions - var touchingTopBar = isPanelVisible && panelContent.allowAttachToBar && root.barPosition === "top" && !root.barIsVertical && Math.abs(panelBackground.targetY - (root.barMarginV + Style.barHeight)) <= 1 - var touchingBottomBar = isPanelVisible && panelContent.allowAttachToBar && root.barPosition === "bottom" && !root.barIsVertical && Math.abs(panelBackground.targetY - (root.height - root.barMarginV - Style.barHeight - panelBackground.targetHeight)) <= 1 - var touchingTopEdge = isPanelVisible && panelContent.allowAttach && panelBackground.targetY <= 1 - var touchingBottomEdge = isPanelVisible && panelContent.allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1) - - if (touchingTopEdge || touchingBottomEdge || touchingTopBar || touchingBottomBar) { + // PRIORITY 1: Bar attachment (always takes precedence) + // If touching any horizontal bar, don't animate from right + if (willTouchTopBar || willTouchBottomBar) { return false } // Attached to bar at right if (willTouchRightBar) { return true } + // PRIORITY 2: Screen edge attachment (only if not touching any bar) + // Don't animate from right if also touching top/bottom edge (priority: vertical over horizontal) + var touchingTopEdge = isPanelVisible && panelContent.allowAttach && panelBackground.targetY <= 1 + var touchingBottomEdge = isPanelVisible && panelContent.allowAttach && (panelBackground.targetY + panelBackground.targetHeight) >= (root.height - 1) + + if (touchingTopEdge || touchingBottomEdge) { + return false + } // Attached to screen right edge (not bar) - if (willTouchRightEdge && !willTouchRightBar) { + if (willTouchRightEdge && !willTouchLeftBar && !willTouchTopBar && !willTouchBottomBar && !willTouchRightBar) { return true } return false