1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-05 05:12:05 -04:00

Implement Auto-Bar location aware shadowing

This commit is contained in:
purian23
2026-02-28 17:54:03 -05:00
parent 1d25d18ca7
commit 36951f82c6
25 changed files with 388 additions and 60 deletions

View File

@@ -45,7 +45,8 @@ Rectangle {
readonly property real baseShadowBlurPx: (shadowElevation && shadowElevation.blurPx !== undefined) ? shadowElevation.blurPx : 4
readonly property real hoverShadowBlurBoost: cardHoverHandler.hovered ? Math.min(2, baseShadowBlurPx * 0.25) : 0
property real shadowBlurPx: shadowsAllowed ? (baseShadowBlurPx + hoverShadowBlurBoost) : 0
property real shadowOffsetYPx: shadowsAllowed ? (1 + (cardHoverHandler.hovered ? 0.35 : 0)) : 0
property real shadowOffsetXPx: shadowsAllowed ? Theme.elevationOffsetX(shadowElevation) : 0
property real shadowOffsetYPx: shadowsAllowed ? (Theme.elevationOffsetY(shadowElevation, 1) + (cardHoverHandler.hovered ? 0.35 : 0)) : 0
property bool __initialized: false
Component.onCompleted: {
@@ -70,6 +71,13 @@ Rectangle {
}
}
Behavior on shadowOffsetXPx {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Behavior on shadowOffsetYPx {
NumberAnimation {
duration: Theme.shortDuration
@@ -138,7 +146,7 @@ Rectangle {
shadowBlur: Math.max(0, Math.min(1, root.shadowBlurPx / Theme.elevationBlurMax))
shadowScale: 1
shadowVerticalOffset: root.shadowOffsetYPx
shadowHorizontalOffset: 0
shadowHorizontalOffset: root.shadowOffsetXPx
blurMax: Theme.elevationBlurMax
shadowColor: root.shadowElevation ? Theme.elevationShadowColor(root.shadowElevation) : "transparent"
}