From cdcfe328d2dec53a9e3ca4b6c6fa21d6f629df3b Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 4 Sep 2025 19:53:33 -0400 Subject: [PATCH] NPanel: rounding x,y coordinates to avoid artifacts --- Widgets/NPanel.qml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 25aaa70..24fc314 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -89,7 +89,7 @@ Loader { screen = aScreen } - // Get t button position if provided + // Get the button position if provided if (buttonItem !== undefined && buttonItem !== null) { useButtonPosition = true @@ -207,31 +207,29 @@ Loader { var maxX = panelWindow.width - panelWidth - (Style.marginS * scaling) var minX = Style.marginS * scaling - return Math.max(minX, Math.min(targetX, maxX)) + return Math.round(Math.max(minX, Math.min(targetX, maxX))) } else if (!panelAnchorHorizontalCenter && panelAnchorLeft) { - return Style.marginS * scaling + return Math.round(marginS * scaling) } else if (!panelAnchorHorizontalCenter && panelAnchorRight) { - return panelWindow.width - panelWidth - (Style.marginS * scaling) + return Math.round(panelWindow.width - panelWidth - (Style.marginS * scaling)) } else { - return (panelWindow.width - panelWidth) / 2 + return Math.round((panelWindow.width - panelWidth) / 2) } } property int calculatedY: { if (panelAnchorVerticalCenter) { - return (panelWindow.height - panelHeight) / 2 + return Math.round((panelWindow.height - panelHeight) / 2) } else if (panelAnchorBottom) { - return panelWindow.height - panelHeight - (Style.marginS * scaling) + return Math.round(panelWindow.height - panelHeight - (Style.marginS * scaling)) } else if (panelAnchorTop) { - return (Style.marginS * scaling) - } else if (panelAnchorBottom) { - panelWindow.height - panelHeight - (Style.marginS * scaling) + return Math.round(Style.marginS * scaling) } else if (!barAtBottom) { // Below the top bar - return Style.marginS * scaling + return Math.round(Style.marginS * scaling) } else { // Above the bottom bar - return panelWindow.height - panelHeight - (Style.marginS * scaling) + return Math.round(panelWindow.height - panelHeight - (Style.marginS * scaling)) } }