mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-08 14:38:30 -04:00
refactor(blurSync): reimplement blur sync in popouts & modals
This commit is contained in:
@@ -62,6 +62,11 @@ Item {
|
|||||||
|
|
||||||
property bool animationsEnabled: true
|
property bool animationsEnabled: true
|
||||||
|
|
||||||
|
function _kickBlurCommit() {
|
||||||
|
if (typeof contentWindow.update === "function")
|
||||||
|
contentWindow.update();
|
||||||
|
}
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
closeTimer.stop();
|
closeTimer.stop();
|
||||||
isClosing = false;
|
isClosing = false;
|
||||||
@@ -201,6 +206,12 @@ Item {
|
|||||||
}
|
}
|
||||||
})(), dpr)
|
})(), dpr)
|
||||||
|
|
||||||
|
onAlignedXChanged: _kickBlurCommit()
|
||||||
|
onAlignedYChanged: _kickBlurCommit()
|
||||||
|
onAlignedWidthChanged: _kickBlurCommit()
|
||||||
|
onAlignedHeightChanged: _kickBlurCommit()
|
||||||
|
onShouldBeVisibleChanged: _kickBlurCommit()
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: clickCatcher
|
id: clickCatcher
|
||||||
visible: false
|
visible: false
|
||||||
@@ -244,11 +255,13 @@ Item {
|
|||||||
WindowBlur {
|
WindowBlur {
|
||||||
targetWindow: contentWindow
|
targetWindow: contentWindow
|
||||||
readonly property real s: Math.min(1, modalContainer.scaleValue)
|
readonly property real s: Math.min(1, modalContainer.scaleValue)
|
||||||
|
readonly property real op: Math.max(0, Math.min(1, (morph.openProgress - 0.06) * 2))
|
||||||
|
readonly property real visibleScale: s * op
|
||||||
// Blur tracks the surface's scaled rect, matching the connected backend.
|
// Blur tracks the surface's scaled rect, matching the connected backend.
|
||||||
blurX: modalContainer.x + modalContainer.width * (1 - s) * 0.5 + Theme.snap(modalContainer.animX, root.dpr)
|
blurX: modalContainer.x + modalContainer.width * (1 - visibleScale) * 0.5 + Theme.snap(modalContainer.animX, root.dpr)
|
||||||
blurY: modalContainer.y + modalContainer.height * (1 - s) * 0.5 + Theme.snap(modalContainer.animY, root.dpr)
|
blurY: modalContainer.y + modalContainer.height * (1 - visibleScale) * 0.5 + Theme.snap(modalContainer.animY, root.dpr)
|
||||||
blurWidth: root.shouldBeVisible ? modalContainer.width * s : 0
|
blurWidth: root.shouldBeVisible ? modalContainer.width * visibleScale : 0
|
||||||
blurHeight: root.shouldBeVisible ? modalContainer.height * s : 0
|
blurHeight: root.shouldBeVisible ? modalContainer.height * visibleScale : 0
|
||||||
blurRadius: root.cornerRadius
|
blurRadius: root.cornerRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,6 +351,7 @@ Item {
|
|||||||
QtObject {
|
QtObject {
|
||||||
id: morph
|
id: morph
|
||||||
property real openProgress: root.shouldBeVisible ? 1 : 0
|
property real openProgress: root.shouldBeVisible ? 1 : 0
|
||||||
|
onOpenProgressChanged: root._kickBlurCommit()
|
||||||
Behavior on openProgress {
|
Behavior on openProgress {
|
||||||
enabled: root.animationsEnabled
|
enabled: root.animationsEnabled
|
||||||
DankAnim {
|
DankAnim {
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ Item {
|
|||||||
readonly property real windowWidth: alignedWidth + contentX + shadowPad
|
readonly property real windowWidth: alignedWidth + contentX + shadowPad
|
||||||
readonly property real windowHeight: alignedHeight + contentY + shadowPad
|
readonly property real windowHeight: alignedHeight + contentY + shadowPad
|
||||||
|
|
||||||
|
onAlignedXChanged: _kickBlurCommit()
|
||||||
|
onAlignedYChanged: _kickBlurCommit()
|
||||||
|
onAlignedWidthChanged: _kickBlurCommit()
|
||||||
|
onAlignedHeightChanged: _kickBlurCommit()
|
||||||
|
onContentVisibleChanged: _kickBlurCommit()
|
||||||
|
|
||||||
readonly property color backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
readonly property color backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
readonly property bool useBackgroundDarken: !FrameTransitionState.effectiveFrameEnabled && SettingsData.modalDarkenBackground
|
readonly property bool useBackgroundDarken: !FrameTransitionState.effectiveFrameEnabled && SettingsData.modalDarkenBackground
|
||||||
readonly property bool useSingleWindow: CompositorService.isHyprland || useBackgroundDarken
|
readonly property bool useSingleWindow: CompositorService.isHyprland || useBackgroundDarken
|
||||||
@@ -113,6 +119,11 @@ Item {
|
|||||||
|
|
||||||
signal dialogClosed
|
signal dialogClosed
|
||||||
|
|
||||||
|
function _kickBlurCommit() {
|
||||||
|
if (typeof launcherWindow.update === "function")
|
||||||
|
launcherWindow.update();
|
||||||
|
}
|
||||||
|
|
||||||
function _ensureContentLoadedAndInitialize(query, mode) {
|
function _ensureContentLoadedAndInitialize(query, mode) {
|
||||||
_pendingQuery = query || "";
|
_pendingQuery = query || "";
|
||||||
_pendingMode = mode || "";
|
_pendingMode = mode || "";
|
||||||
@@ -366,11 +377,13 @@ Item {
|
|||||||
WindowBlur {
|
WindowBlur {
|
||||||
targetWindow: launcherWindow
|
targetWindow: launcherWindow
|
||||||
readonly property real s: Math.min(1, modalContainer.publishedScale)
|
readonly property real s: Math.min(1, modalContainer.publishedScale)
|
||||||
|
readonly property real op: Math.max(0, Math.min(1, (modalContainer.opacity - 0.06) * 2))
|
||||||
|
readonly property real visibleScale: s * op
|
||||||
// Blur tracks the surface's scaled rect
|
// Blur tracks the surface's scaled rect
|
||||||
blurX: modalContainer.x + modalContainer.width * (1 - s) * 0.5
|
blurX: modalContainer.x + modalContainer.width * (1 - visibleScale) * 0.5
|
||||||
blurY: modalContainer.y + modalContainer.height * (1 - s) * 0.5
|
blurY: modalContainer.y + modalContainer.height * (1 - visibleScale) * 0.5
|
||||||
blurWidth: contentVisible ? modalContainer.width * s : 0
|
blurWidth: contentVisible ? modalContainer.width * visibleScale : 0
|
||||||
blurHeight: contentVisible ? modalContainer.height * s : 0
|
blurHeight: contentVisible ? modalContainer.height * visibleScale : 0
|
||||||
blurRadius: root.cornerRadius
|
blurRadius: root.cornerRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,6 +473,8 @@ Item {
|
|||||||
opacity: contentVisible ? 1 : 0
|
opacity: contentVisible ? 1 : 0
|
||||||
scale: contentVisible ? 1 : 0.96
|
scale: contentVisible ? 1 : 0.96
|
||||||
transformOrigin: Item.Center
|
transformOrigin: Item.Center
|
||||||
|
onOpacityChanged: root._kickBlurCommit()
|
||||||
|
onPublishedScaleChanged: root._kickBlurCommit()
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|||||||
@@ -620,13 +620,15 @@ Item {
|
|||||||
id: popoutBlur
|
id: popoutBlur
|
||||||
targetWindow: contentWindow
|
targetWindow: contentWindow
|
||||||
readonly property real s: Math.min(1, contentContainer.scaleValue)
|
readonly property real s: Math.min(1, contentContainer.scaleValue)
|
||||||
|
readonly property real op: Math.max(0, Math.min(1, (morph.openProgress - 0.08) * 1.6))
|
||||||
|
readonly property real visibleScale: s * op
|
||||||
readonly property bool revealClipActive: root.fluidStandaloneActive
|
readonly property bool revealClipActive: root.fluidStandaloneActive
|
||||||
|
|
||||||
// Blur tracks the surface's scaled rect, matching the connected backend
|
// Blur tracks the surface's scaled rect, matching the connected backend
|
||||||
blurX: revealClipActive ? contentContainer.x : contentContainer.x + contentContainer.width * (1 - s) * 0.5 + Theme.snap(contentContainer.animX, root.dpr)
|
blurX: revealClipActive ? contentContainer.x : contentContainer.x + contentContainer.width * (1 - visibleScale) * 0.5 + Theme.snap(contentContainer.animX, root.dpr)
|
||||||
blurY: revealClipActive ? contentContainer.y : contentContainer.y + contentContainer.height * (1 - s) * 0.5 + Theme.snap(contentContainer.animY, root.dpr)
|
blurY: revealClipActive ? contentContainer.y : contentContainer.y + contentContainer.height * (1 - visibleScale) * 0.5 + Theme.snap(contentContainer.animY, root.dpr)
|
||||||
blurWidth: root.shouldBeVisible ? (revealClipActive ? contentContainer.width : contentContainer.width * s) : 0
|
blurWidth: root.shouldBeVisible ? (revealClipActive ? contentContainer.width : contentContainer.width * visibleScale) : 0
|
||||||
blurHeight: root.shouldBeVisible ? (revealClipActive ? contentContainer.height : contentContainer.height * s) : 0
|
blurHeight: root.shouldBeVisible ? (revealClipActive ? contentContainer.height : contentContainer.height * visibleScale) : 0
|
||||||
blurRadius: Theme.cornerRadius
|
blurRadius: Theme.cornerRadius
|
||||||
clipEnabled: revealClipActive
|
clipEnabled: revealClipActive
|
||||||
clipX: contentContainer.x + contentContainer.revealX
|
clipX: contentContainer.x + contentContainer.revealX
|
||||||
@@ -742,8 +744,7 @@ Item {
|
|||||||
QtObject {
|
QtObject {
|
||||||
id: morph
|
id: morph
|
||||||
property real openProgress: 0
|
property real openProgress: 0
|
||||||
onOpenProgressChanged: if (root.fluidStandaloneActive)
|
onOpenProgressChanged: root._kickBlurCommit()
|
||||||
root._kickBlurCommit()
|
|
||||||
Behavior on openProgress {
|
Behavior on openProgress {
|
||||||
enabled: root.animationsEnabled
|
enabled: root.animationsEnabled
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|||||||
Reference in New Issue
Block a user