forked from Shinonome/dots-hyprland
overview: more rounding
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import qs
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
@@ -14,25 +15,23 @@ Item { // Window
|
||||
property var windowData
|
||||
property var monitorData
|
||||
property var scale
|
||||
property var availableWorkspaceWidth
|
||||
property var availableWorkspaceHeight
|
||||
property bool restrictToWorkspace: true
|
||||
property real widthRatio: {
|
||||
const widgetWidth = widgetMonitor.transform & 1 ? widgetMonitor.height : widgetMonitor.width;
|
||||
const monitorWidth = monitorData.transform & 1 ? monitorData.height : monitorData.width;
|
||||
(widgetWidth * monitorData.scale) / (monitorWidth * widgetMonitor.scale);
|
||||
return (widgetWidth * monitorData.scale) / (monitorWidth * widgetMonitor.scale);
|
||||
}
|
||||
property real heightRatio: {
|
||||
const widgetHeight = widgetMonitor.transform & 1 ? widgetMonitor.width : widgetMonitor.height;
|
||||
const monitorHeight = monitorData.transform & 1 ? monitorData.width : monitorData.height;
|
||||
(widgetHeight * monitorData.scale) / (monitorHeight * widgetMonitor.scale);
|
||||
return (widgetHeight * monitorData.scale) / (monitorHeight * widgetMonitor.scale);
|
||||
}
|
||||
property real initX: {
|
||||
Math.max((windowData?.at[0] - (monitorData?.x ?? 0) - monitorData?.reserved[0]) * widthRatio * root.scale, 0) + xOffset;
|
||||
return Math.max((windowData?.at[0] - (monitorData?.x ?? 0) - monitorData?.reserved[0]) * widthRatio * root.scale, 0) + xOffset;
|
||||
}
|
||||
|
||||
property real initY: {
|
||||
Math.max((windowData?.at[1] - (monitorData?.y ?? 0) - monitorData?.reserved[1]) * heightRatio * root.scale, 0) + yOffset;
|
||||
return Math.max((windowData?.at[1] - (monitorData?.y ?? 0) - monitorData?.reserved[1]) * heightRatio * root.scale, 0) + yOffset;
|
||||
}
|
||||
property real xOffset: 0
|
||||
property real yOffset: 0
|
||||
@@ -58,12 +57,20 @@ Item { // Window
|
||||
height: targetWindowHeight
|
||||
opacity: windowData.monitor == widgetMonitorId ? 1 : 0.4
|
||||
|
||||
property real topLeftRadius
|
||||
property real topRightRadius
|
||||
property real bottomLeftRadius
|
||||
property real bottomRightRadius
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: Rectangle {
|
||||
width: root.width
|
||||
height: root.height
|
||||
radius: Appearance.rounding.windowRounding * root.scale
|
||||
topLeftRadius: root.topLeftRadius
|
||||
topRightRadius: root.topRightRadius
|
||||
bottomRightRadius: root.bottomRightRadius
|
||||
bottomLeftRadius: root.bottomLeftRadius
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +96,14 @@ Item { // Window
|
||||
// Color overlay for interactions
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.rounding.windowRounding * root.scale
|
||||
topLeftRadius: root.topLeftRadius
|
||||
topRightRadius: root.topRightRadius
|
||||
bottomRightRadius: root.bottomRightRadius
|
||||
bottomLeftRadius: root.bottomLeftRadius
|
||||
color: pressed ? ColorUtils.transparentize(Appearance.colors.colLayer2Active, 0.5) :
|
||||
hovered ? ColorUtils.transparentize(Appearance.colors.colLayer2Hover, 0.7) :
|
||||
ColorUtils.transparentize(Appearance.colors.colLayer2)
|
||||
border.color : ColorUtils.transparentize(Appearance.m3colors.m3outline, 0.7)
|
||||
border.color : ColorUtils.transparentize(Appearance.m3colors.m3outline, 0.88)
|
||||
border.width : 1
|
||||
}
|
||||
|
||||
@@ -106,7 +116,7 @@ Item { // Window
|
||||
// console.log("Icon ratio:", root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio)
|
||||
// console.log("Scale:", root.monitorData.scale)
|
||||
// console.log("Final:", Math.min(targetWindowWidth, targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio) / root.monitorData.scale)
|
||||
return Math.min(targetWindowWidth, targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio);
|
||||
return Math.min(root.targetWindowWidth, root.targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio);
|
||||
}
|
||||
// mipmap: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
Reference in New Issue
Block a user