Bar: reimplemented hairline gap safety.

This commit is contained in:
ItsLemmy
2025-11-11 06:21:58 -05:00
parent 38da6dbfcf
commit 877f517a02
3 changed files with 16 additions and 38 deletions
+5 -28
View File
@@ -27,8 +27,6 @@ Item {
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: 0 //barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: 0 //barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
// Fill the parent (the Loader)
anchors.fill: parent
@@ -38,7 +36,6 @@ Item {
if (screen && screen.name) {
Logger.d("Bar", "Bar screen set to:", screen.name)
Logger.d("Bar", " Position:", barPosition, "Floating:", barFloating)
Logger.d("Bar", " Margins - H:", barMarginH, "V:", barMarginV)
BarService.registerBar(screen.name)
}
}
@@ -64,31 +61,11 @@ Item {
Item {
id: bar
// Position and size the bar based on orientation and floating margins
x: {
var baseX = (root.barPosition === "right") ? (parent.width - Style.barHeight - root.barMarginH) : root.barMarginH
if (root.barPosition === "right")
return baseX // Extend left towards panels
return baseX
}
y: {
var baseY = (root.barPosition === "bottom") ? (parent.height - Style.barHeight - root.barMarginV) : root.barMarginV
if (root.barPosition === "bottom")
return baseY // Extend up towards panels
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 + 1
}
height: {
var baseHeight = root.barIsVertical ? (parent.height - root.barMarginV * 2) : Style.barHeight
if (!root.barIsVertical)
return baseHeight
return baseHeight // Vertical bars extend via width, not height
}
// Position and size the bar content based on orientation
x: (root.barPosition === "right") ? (parent.width - Style.barHeight) : 0.5
y: (root.barPosition === "bottom") ? (parent.height - Style.barHeight) : 0.5
width: root.barIsVertical ? Style.barHeight : parent.width
height: root.barIsVertical ? parent.height : Style.barHeight
// Corner states for new unified background system
// State -1: No radius (flat/square corner)
+2 -2
View File
@@ -34,8 +34,8 @@ PanelWindow {
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
readonly property real barMarginH: Math.round(barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0)
readonly property real barMarginV: Math.round(barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0)
// Anchor to the bar's edge
anchors {
+9 -8
View File
@@ -326,7 +326,7 @@ PanelWindow {
}
}
// Bar placeholder - just for background positioning (actual bar content is in BarContentWindow)
// Bar background placeholder - just for background positioning (actual bar content is in BarContentWindow)
Item {
id: barPlaceholder
@@ -336,28 +336,29 @@ PanelWindow {
// Screen reference
property ShellScreen screen: root.screen
// Bar positioning properties (match Bar.qml logic)
// Bar background positioning properties
readonly property string barPosition: Settings.data.bar.position || "top"
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
readonly property bool barFloating: Settings.data.bar.floating || false
readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
readonly property real barMarginH: barFloating ? Math.round(Settings.data.bar.marginHorizontal * Style.marginXL) : 0
readonly property real barMarginV: barFloating ? Math.round(Settings.data.bar.marginVertical * Style.marginXL) : 0
readonly property real attachmentOverlap: 1 // Attachment overlap to fix hairline gap with fractional scaling
// Expose bar dimensions directly on this Item for BarBackground
// Use screen dimensions directly
x: {
if (barPosition === "right")
return screen.width - Style.barHeight - barMarginH
return screen.width - Style.barHeight - barMarginH - attachmentOverlap // Extend left towards panels
return barMarginH
}
y: {
if (barPosition === "bottom")
return screen.height - Style.barHeight - barMarginV
return screen.height - Style.barHeight - barMarginV - attachmentOverlap
return barMarginV
}
width: {
if (barIsVertical) {
return Style.barHeight + 1
return Style.barHeight + attachmentOverlap
}
return screen.width - barMarginH * 2
}
@@ -365,7 +366,7 @@ PanelWindow {
if (barIsVertical) {
return screen.height - barMarginV * 2
}
return Style.barHeight
return Style.barHeight + attachmentOverlap
}
// Corner states (same as Bar.qml)