Bar/NPanels Improvements

- Fix potential hairline gap with fractional scaling
- Apply auto-snap rules even to centered anchored panels
- Improving animations and sizing
This commit is contained in:
Sébastien Atoch
2025-11-04 00:33:29 -05:00
parent c911756f5e
commit 057693fae3
5 changed files with 82 additions and 35 deletions
+1
View File
@@ -58,6 +58,7 @@ NPanel {
// Use implicitHeight from content + margins to avoid binding loops
property real contentPreferredHeight: mainColumn.implicitHeight + Style.marginL * 2
// property real contentPreferredHeight: Math.min(screen.height * 0.42, mainColumn.implicitHeight) + Style.marginL * 2
ColumnLayout {
id: mainColumn
+28 -4
View File
@@ -27,6 +27,9 @@ Item {
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
// Attachment overlap to fix hairline gap with fractional scaling
readonly property real attachmentOverlap: 1
// Fill the parent (the Loader)
anchors.fill: parent
@@ -54,10 +57,31 @@ Item {
id: bar
// Position and size the bar based on orientation and floating margins
x: (root.barPosition === "right") ? (parent.width - Style.barHeight - root.barMarginH) : root.barMarginH
y: (root.barPosition === "bottom") ? (parent.height - Style.barHeight - root.barMarginV) : root.barMarginV
width: root.barIsVertical ? Style.barHeight : (parent.width - root.barMarginH * 2)
height: root.barIsVertical ? (parent.height - root.barMarginV * 2) : Style.barHeight
// Extend the bar by attachmentOverlap to eliminate hairline gap
x: {
var baseX = (root.barPosition === "right") ? (parent.width - Style.barHeight - root.barMarginH) : root.barMarginH
if (root.barPosition === "right")
return baseX + root.attachmentOverlap
return baseX
}
y: {
var baseY = (root.barPosition === "bottom") ? (parent.height - Style.barHeight - root.barMarginV) : root.barMarginV
if (root.barPosition === "bottom")
return baseY + root.attachmentOverlap
return baseY
}
width: {
var baseWidth = root.barIsVertical ? Style.barHeight : (parent.width - root.barMarginH * 2)
if (!root.barIsVertical)
return baseWidth // Horizontal bars extend via height, not width
return baseWidth + root.attachmentOverlap
}
height: {
var baseHeight = root.barIsVertical ? (parent.height - root.barMarginV * 2) : Style.barHeight
if (!root.barIsVertical)
return baseHeight + root.attachmentOverlap
return baseHeight // Vertical bars extend via width, not height
}
backgroundColor: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
+3 -1
View File
@@ -12,7 +12,7 @@ NPanel {
id: root
preferredWidth: 820 * Style.uiScaleRatio
preferredHeight: 940 * Style.uiScaleRatio
preferredHeight: 900 * Style.uiScaleRatio
panelAnchorHorizontalCenter: true
panelAnchorVerticalCenter: true
@@ -335,6 +335,8 @@ NPanel {
// Sidebar
Rectangle {
id: sidebar
clip: true
Layout.preferredWidth: 220 * Style.uiScaleRatio
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
+1 -1
View File
@@ -424,7 +424,7 @@ NPanel {
model: filteredWallpapers
property int columns: 5
property int columns: (screen.width > 1920) ? 5 : 4
property int itemSize: cellWidth
cellWidth: Math.floor((width - leftMargin - rightMargin) / columns)