1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 23:12:49 -05:00

bar: more repaint triggers + repaint debounce

This commit is contained in:
bbedward
2025-10-13 14:38:03 -04:00
parent 5f7e478118
commit 6814b140fc

View File

@@ -16,6 +16,21 @@ Item {
anchors.topMargin: -(SettingsData.dankBarGothCornersEnabled && !axis.isVertical && axis.edge === "bottom" ? barWindow._wingR : 0) anchors.topMargin: -(SettingsData.dankBarGothCornersEnabled && !axis.isVertical && axis.edge === "bottom" ? barWindow._wingR : 0)
anchors.bottomMargin: -(SettingsData.dankBarGothCornersEnabled && !axis.isVertical && axis.edge === "top" ? barWindow._wingR : 0) anchors.bottomMargin: -(SettingsData.dankBarGothCornersEnabled && !axis.isVertical && axis.edge === "top" ? barWindow._wingR : 0)
function requestRepaint() {
debounceTimer.restart()
}
Timer {
id: debounceTimer
interval: 50
repeat: false
onTriggered: {
barShape.requestPaint()
barTint.requestPaint()
barBorder.requestPaint()
}
}
Canvas { Canvas {
id: barShape id: barShape
anchors.fill: parent anchors.fill: parent
@@ -30,21 +45,22 @@ Item {
property real wing: SettingsData.dankBarGothCornersEnabled ? barWindow._wingR : 0 property real wing: SettingsData.dankBarGothCornersEnabled ? barWindow._wingR : 0
property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius
onWingChanged: requestPaint() onWingChanged: root.requestRepaint()
onRtChanged: requestPaint() onRtChanged: root.requestRepaint()
onCorrectWidthChanged: requestPaint() onCorrectWidthChanged: root.requestRepaint()
onCorrectHeightChanged: requestPaint() onCorrectHeightChanged: root.requestRepaint()
onVisibleChanged: if (visible) requestPaint() onVisibleChanged: if (visible) root.requestRepaint()
Component.onCompleted: requestPaint() Component.onCompleted: root.requestRepaint()
Connections { Connections {
target: barWindow target: barWindow
function on_BgColorChanged() { barShape.requestPaint() } function on_BgColorChanged() { root.requestRepaint() }
} }
Connections { Connections {
target: Theme target: Theme
function onIsLightModeChanged() { barShape.requestPaint() } function onIsLightModeChanged() { root.requestRepaint() }
function onSurfaceContainerChanged() { root.requestRepaint() }
} }
onPaint: { onPaint: {
@@ -122,22 +138,24 @@ Item {
property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius
property real alphaTint: (barWindow._bgColor?.a ?? 1) < 0.99 ? (Theme.stateLayerOpacity ?? 0) : 0 property real alphaTint: (barWindow._bgColor?.a ?? 1) < 0.99 ? (Theme.stateLayerOpacity ?? 0) : 0
onWingChanged: requestPaint() onWingChanged: root.requestRepaint()
onRtChanged: requestPaint() onRtChanged: root.requestRepaint()
onAlphaTintChanged: requestPaint() onAlphaTintChanged: root.requestRepaint()
onCorrectWidthChanged: requestPaint() onCorrectWidthChanged: root.requestRepaint()
onCorrectHeightChanged: requestPaint() onCorrectHeightChanged: root.requestRepaint()
onVisibleChanged: if (visible) requestPaint() onVisibleChanged: if (visible) root.requestRepaint()
Component.onCompleted: requestPaint() Component.onCompleted: root.requestRepaint()
Connections { Connections {
target: barWindow target: barWindow
function on_BgColorChanged() { barTint.requestPaint() } function on_BgColorChanged() { root.requestRepaint() }
} }
Connections { Connections {
target: Theme target: Theme
function onIsLightModeChanged() { barTint.requestPaint() } function onIsLightModeChanged() { root.requestRepaint() }
function onSurfaceChanged() { root.requestRepaint() }
function onStateLayerOpacityChanged() { root.requestRepaint() }
} }
onPaint: { onPaint: {
@@ -216,26 +234,30 @@ Item {
property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius
property bool borderEnabled: SettingsData.dankBarBorderEnabled property bool borderEnabled: SettingsData.dankBarBorderEnabled
onWingChanged: requestPaint() onWingChanged: root.requestRepaint()
onRtChanged: requestPaint() onRtChanged: root.requestRepaint()
onBorderEnabledChanged: requestPaint() onBorderEnabledChanged: root.requestRepaint()
onCorrectWidthChanged: requestPaint() onCorrectWidthChanged: root.requestRepaint()
onCorrectHeightChanged: requestPaint() onCorrectHeightChanged: root.requestRepaint()
onVisibleChanged: if (visible) requestPaint() onVisibleChanged: if (visible) root.requestRepaint()
Component.onCompleted: requestPaint() Component.onCompleted: root.requestRepaint()
Connections { Connections {
target: Theme target: Theme
function onIsLightModeChanged() { barBorder.requestPaint() } function onIsLightModeChanged() { root.requestRepaint() }
function onSurfaceTextChanged() { root.requestRepaint() }
function onPrimaryChanged() { root.requestRepaint() }
function onSecondaryChanged() { root.requestRepaint() }
function onOutlineChanged() { root.requestRepaint() }
} }
Connections { Connections {
target: SettingsData target: SettingsData
function onDankBarBorderColorChanged() { barBorder.requestPaint() } function onDankBarBorderColorChanged() { root.requestRepaint() }
function onDankBarBorderOpacityChanged() { barBorder.requestPaint() } function onDankBarBorderOpacityChanged() { root.requestRepaint() }
function onDankBarBorderThicknessChanged() { barBorder.requestPaint() } function onDankBarBorderThicknessChanged() { root.requestRepaint() }
function onDankBarSpacingChanged() { barBorder.requestPaint() } function onDankBarSpacingChanged() { root.requestRepaint() }
function onDankBarSquareCornersChanged() { barBorder.requestPaint() } function onDankBarSquareCornersChanged() { root.requestRepaint() }
} }
onPaint: { onPaint: {