SmartPanel: Improved rolldown direction when the bar is not floating

This commit is contained in:
Sébastien Atoch
2025-11-08 08:51:08 -05:00
parent 1755e9157c
commit 5c8801ba76
+30 -20
View File
@@ -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