mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 17:52:10 -04:00
(frame): Update Connected blur Arcs & Enable shadow modes
This commit is contained in:
@@ -41,6 +41,7 @@ PanelWindow {
|
||||
required property string notificationId
|
||||
readonly property bool hasValidData: notificationData && notificationData.notification
|
||||
readonly property alias hovered: cardHoverHandler.hovered
|
||||
readonly property alias swipeActive: content.swipeActive
|
||||
property int screenY: 0
|
||||
property bool exiting: false
|
||||
property bool _isDestroying: false
|
||||
@@ -64,8 +65,8 @@ PanelWindow {
|
||||
readonly property real exitTravel: {
|
||||
if (directionalEffect) {
|
||||
if (isCenterPosition)
|
||||
return content.height + entryTravel;
|
||||
return content.width + entryTravel;
|
||||
return Math.max(1, content.height);
|
||||
return Math.max(1, content.width);
|
||||
}
|
||||
if (depthEffect)
|
||||
return Math.round(entryTravel * 1.35);
|
||||
@@ -186,7 +187,7 @@ PanelWindow {
|
||||
enabled: !exiting && !_isDestroying
|
||||
NumberAnimation {
|
||||
id: implicitHeightAnim
|
||||
duration: Theme.variantDuration(descriptionExpanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration, descriptionExpanded)
|
||||
duration: descriptionExpanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: descriptionExpanded ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
|
||||
onFinished: win.popupHeightChanged()
|
||||
@@ -237,7 +238,8 @@ PanelWindow {
|
||||
readonly property real maxPopupShadowBlurPx: Math.max((Theme.elevationLevel3 && Theme.elevationLevel3.blurPx !== undefined) ? Theme.elevationLevel3.blurPx : 12, (Theme.elevationLevel4 && Theme.elevationLevel4.blurPx !== undefined) ? Theme.elevationLevel4.blurPx : 16)
|
||||
readonly property real maxPopupShadowOffsetXPx: Math.max(Math.abs(Theme.elevationOffsetX(Theme.elevationLevel3)), Math.abs(Theme.elevationOffsetX(Theme.elevationLevel4)))
|
||||
readonly property real maxPopupShadowOffsetYPx: Math.max(Math.abs(Theme.elevationOffsetY(Theme.elevationLevel3, 6)), Math.abs(Theme.elevationOffsetY(Theme.elevationLevel4, 8)))
|
||||
readonly property real windowShadowPad: Theme.elevationEnabled && SettingsData.notificationPopupShadowEnabled ? Theme.snap(Math.max(16, maxPopupShadowBlurPx + Math.max(maxPopupShadowOffsetXPx, maxPopupShadowOffsetYPx) + 8), dpr) : 0
|
||||
readonly property bool popupWindowShadowActive: Theme.elevationEnabled && SettingsData.notificationPopupShadowEnabled && !connectedFrameMode
|
||||
readonly property real windowShadowPad: popupWindowShadowActive ? Theme.snap(Math.max(16, maxPopupShadowBlurPx + Math.max(maxPopupShadowOffsetXPx, maxPopupShadowOffsetYPx) + 8), dpr) : 0
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
@@ -404,7 +406,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
function popupChromeMotionActive() {
|
||||
return exiting || content.swipeActive || content.swipeDismissing || Math.abs(content.swipeOffset) > 0.5;
|
||||
return popupChromeOpenProgress() < 1 || exiting || content.swipeActive || content.swipeDismissing || Math.abs(content.swipeOffset) > 0.5;
|
||||
}
|
||||
|
||||
function popupLayoutReservesSlot() {
|
||||
@@ -415,13 +417,30 @@ PanelWindow {
|
||||
return !content.swipeDismissing;
|
||||
}
|
||||
|
||||
function _chromeMotionOffset() {
|
||||
return isCenterPosition ? tx.y : tx.x;
|
||||
}
|
||||
|
||||
function _chromeCardTravel() {
|
||||
return Math.max(1, isCenterPosition ? alignedHeight : alignedWidth);
|
||||
}
|
||||
|
||||
function popupChromeOpenProgress() {
|
||||
if (exiting || content.swipeDismissing)
|
||||
return 1;
|
||||
return Math.max(0, Math.min(1, 1 - Math.abs(_chromeMotionOffset()) / _chromeCardTravel()));
|
||||
}
|
||||
|
||||
function popupChromeReleaseProgress() {
|
||||
if (exiting)
|
||||
return Math.max(0, Math.min(1, Math.abs(_chromeMotionOffset()) / _chromeCardTravel()));
|
||||
if (content.swipeDismissing)
|
||||
return Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance)));
|
||||
if (!exiting)
|
||||
return 0;
|
||||
const exitOffset = isCenterPosition ? tx.y : tx.x;
|
||||
return Math.max(0, Math.min(1, Math.abs(exitOffset) / Math.max(1, exitTravel)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
function popupChromeFollowsCardMotion() {
|
||||
return content.swipeActive || (content.swipeDismissing && !exiting);
|
||||
}
|
||||
|
||||
function popupChromeMotionX() {
|
||||
@@ -488,7 +507,7 @@ PanelWindow {
|
||||
win.popupChromeGeometryChanged();
|
||||
}
|
||||
|
||||
readonly property bool shadowsAllowed: Theme.elevationEnabled && SettingsData.notificationPopupShadowEnabled
|
||||
readonly property bool shadowsAllowed: win.popupWindowShadowActive
|
||||
readonly property var elevLevel: cardHoverHandler.hovered ? Theme.elevationLevel4 : Theme.elevationLevel3
|
||||
readonly property real cardInset: Theme.snap(4, win.dpr)
|
||||
readonly property real shadowRenderPadding: shadowsAllowed ? Theme.snap(Math.max(16, shadowBlurPx + Math.max(Math.abs(shadowOffsetX), Math.abs(shadowOffsetY)) + 8), win.dpr) : 0
|
||||
@@ -527,7 +546,7 @@ PanelWindow {
|
||||
shadowOffsetX: content.shadowOffsetX
|
||||
shadowOffsetY: content.shadowOffsetY
|
||||
shadowColor: content.shadowsAllowed && content.elevLevel ? Theme.elevationShadowColor(content.elevLevel) : "transparent"
|
||||
shadowEnabled: !win._isDestroying && win.screenValid && content.shadowsAllowed && !win.connectedFrameMode
|
||||
shadowEnabled: !win._isDestroying && win.screenValid && content.shadowsAllowed
|
||||
layer.textureSize: Qt.size(Math.round(width * win.dpr), Math.round(height * win.dpr))
|
||||
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
||||
|
||||
@@ -1091,7 +1110,7 @@ PanelWindow {
|
||||
return isLeft ? -entryTravel : entryTravel;
|
||||
}
|
||||
to: 0
|
||||
duration: Theme.variantDuration(Theme.notificationEnterDuration, true)
|
||||
duration: Theme.notificationEnterDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Theme.variantPopoutEnterCurve
|
||||
onStopped: {
|
||||
@@ -1124,7 +1143,7 @@ PanelWindow {
|
||||
const isLeft = SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom;
|
||||
return isLeft ? -exitTravel : exitTravel;
|
||||
}
|
||||
duration: Theme.variantDuration(Theme.notificationExitDuration, false)
|
||||
duration: Theme.notificationExitDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Theme.variantPopoutExitCurve
|
||||
}
|
||||
@@ -1134,7 +1153,7 @@ PanelWindow {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: Theme.isDirectionalEffect ? 1 : 0
|
||||
duration: Theme.variantDuration(Theme.notificationExitDuration, false)
|
||||
duration: Theme.notificationExitDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Theme.variantPopoutExitCurve
|
||||
}
|
||||
@@ -1144,7 +1163,7 @@ PanelWindow {
|
||||
property: "scale"
|
||||
from: 1
|
||||
to: Theme.isDirectionalEffect ? 1 : Theme.effectScaleCollapsed
|
||||
duration: Theme.variantDuration(Theme.notificationExitDuration, false)
|
||||
duration: Theme.notificationExitDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Theme.variantPopoutExitCurve
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ QtObject {
|
||||
property var pendingDestroys: []
|
||||
property int destroyDelayMs: 100
|
||||
property bool _chromeSyncPending: false
|
||||
readonly property real chromeOpenProgressThreshold: 0.10
|
||||
readonly property real chromeReleaseTailStart: 0.90
|
||||
readonly property real chromeReleaseDropProgress: 0.995
|
||||
property Component popupComponent
|
||||
|
||||
popupComponent: Component {
|
||||
@@ -130,7 +133,20 @@ QtObject {
|
||||
}
|
||||
|
||||
function _chromeWindows() {
|
||||
return popupWindows.filter(p => p && p.status !== Component.Null && p.visible && !p._finalized && p.hasValidData && (p.notificationData?.popup || p.exiting));
|
||||
return popupWindows.filter(p => {
|
||||
if (!p || p.status === Component.Null || !p.visible || p._finalized || !p.hasValidData)
|
||||
return false;
|
||||
if (!p.notificationData?.popup && !p.exiting)
|
||||
return false;
|
||||
if (!p.exiting && p.popupChromeOpenProgress && p.popupChromeOpenProgress() < chromeOpenProgressThreshold)
|
||||
return false;
|
||||
// Keep the connected shell until the card is almost fully closed.
|
||||
if (p.exiting && !p.swipeActive && p.popupChromeReleaseProgress) {
|
||||
if (p.popupChromeReleaseProgress() > chromeReleaseDropProgress)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function _isFocusedScreen() {
|
||||
@@ -225,23 +241,72 @@ QtObject {
|
||||
});
|
||||
}
|
||||
|
||||
function _clamp01(value) {
|
||||
return Math.max(0, Math.min(1, value));
|
||||
}
|
||||
|
||||
function _clipRectFromBarSide(rect, visibleFraction) {
|
||||
const fraction = _clamp01(visibleFraction);
|
||||
const w = Math.max(0, rect.right - rect.x);
|
||||
const h = Math.max(0, rect.bottom - rect.y);
|
||||
|
||||
if (notifBarSide === "right") {
|
||||
rect.x = rect.right - w * fraction;
|
||||
} else if (notifBarSide === "left") {
|
||||
rect.right = rect.x + w * fraction;
|
||||
} else if (notifBarSide === "bottom") {
|
||||
rect.y = rect.bottom - h * fraction;
|
||||
} else {
|
||||
rect.bottom = rect.y + h * fraction;
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
function _popupChromeVisibleFraction(p) {
|
||||
if (p.exiting && p.popupChromeReleaseProgress)
|
||||
return 1 - _chromeReleaseTailProgress(p.popupChromeReleaseProgress());
|
||||
if (!p.exiting && p.popupChromeOpenProgress)
|
||||
return _clamp01(p.popupChromeOpenProgress());
|
||||
return 1;
|
||||
}
|
||||
|
||||
function _popupChromeRect(p, useMotionOffset) {
|
||||
if (!p || !p.screen)
|
||||
return null;
|
||||
const motionX = useMotionOffset && p.popupChromeMotionX ? p.popupChromeMotionX() : 0;
|
||||
const motionY = useMotionOffset && p.popupChromeMotionY ? p.popupChromeMotionY() : 0;
|
||||
const x = (p.getContentX ? p.getContentX() : 0) + motionX;
|
||||
const y = (p.getContentY ? p.getContentY() : 0) + motionY;
|
||||
const x = p.getContentX ? p.getContentX() : 0;
|
||||
const y = p.getContentY ? p.getContentY() : 0;
|
||||
const w = p.alignedWidth || 0;
|
||||
const h = Math.max(p.alignedHeight || 0, baseNotificationHeight);
|
||||
if (w <= 0 || h <= 0)
|
||||
return null;
|
||||
return {
|
||||
const rect = {
|
||||
x: x,
|
||||
y: y,
|
||||
right: x + w,
|
||||
bottom: y + h
|
||||
};
|
||||
|
||||
if (!useMotionOffset)
|
||||
return rect;
|
||||
|
||||
if (p.popupChromeFollowsCardMotion && p.popupChromeFollowsCardMotion()) {
|
||||
const motionX = p.popupChromeMotionX ? p.popupChromeMotionX() : 0;
|
||||
const motionY = p.popupChromeMotionY ? p.popupChromeMotionY() : 0;
|
||||
rect.x += motionX;
|
||||
rect.y += motionY;
|
||||
rect.right += motionX;
|
||||
rect.bottom += motionY;
|
||||
return rect;
|
||||
}
|
||||
|
||||
return _clipRectFromBarSide(rect, _popupChromeVisibleFraction(p));
|
||||
}
|
||||
|
||||
function _chromeReleaseTailProgress(rawProgress) {
|
||||
const progress = Math.max(0, Math.min(1, rawProgress));
|
||||
if (progress <= chromeReleaseTailStart)
|
||||
return 0;
|
||||
return Math.max(0, Math.min(1, (progress - chromeReleaseTailStart) / Math.max(0.001, 1 - chromeReleaseTailStart)));
|
||||
}
|
||||
|
||||
function _popupChromeBoundsRect(p, trailing, useMotionOffset) {
|
||||
@@ -249,7 +314,7 @@ QtObject {
|
||||
if (!rect || p !== trailing || !p.popupChromeReleaseProgress)
|
||||
return rect;
|
||||
|
||||
const progress = Math.max(0, Math.min(1, p.popupChromeReleaseProgress()));
|
||||
const progress = _chromeReleaseTailProgress(p.popupChromeReleaseProgress());
|
||||
if (progress <= 0)
|
||||
return rect;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user