1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-16 10:42:06 -04:00

frame(Notifications): Update Arc path & Motion

This commit is contained in:
purian23
2026-04-14 14:20:40 -04:00
parent 7568d5a4e1
commit 995995034b
2 changed files with 37 additions and 7 deletions

View File

@@ -42,6 +42,14 @@ PanelWindow {
readonly property bool hasValidData: notificationData && notificationData.notification
readonly property alias hovered: cardHoverHandler.hovered
readonly property alias swipeActive: content.swipeActive
readonly property alias swipeDismissing: content.swipeDismissing
readonly property bool swipeDismissTowardEdge: {
if (content.swipeDismissing)
return _swipeDismissesTowardFrameEdge();
if (content.swipeActive)
return content.swipeOffset * _frameEdgeSwipeDirection() > 0;
return false;
}
property int screenY: 0
property bool exiting: false
property bool _isDestroying: false
@@ -432,15 +440,23 @@ PanelWindow {
}
function popupChromeReleaseProgress() {
if (exiting)
return Math.max(0, Math.min(1, Math.abs(_chromeMotionOffset()) / _chromeCardTravel()));
if (exiting) {
const exitRel = Math.max(0, Math.min(1, Math.abs(_chromeMotionOffset()) / _chromeCardTravel()));
if (content.swipeDismissing) {
const swipeRel = Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance)));
return Math.max(exitRel, swipeRel);
}
return exitRel;
}
if (content.swipeDismissing)
return Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance)));
if (content.swipeActive && content.swipeOffset * _frameEdgeSwipeDirection() > 0)
return Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance)));
return 0;
}
function popupChromeFollowsCardMotion() {
return content.swipeActive || (content.swipeDismissing && !exiting);
return false;
}
function popupChromeMotionX() {
@@ -1059,7 +1075,7 @@ PanelWindow {
const inwardConnectedExit = win.connectedFrameMode && !win.isCenterPosition && !win._swipeDismissesTowardFrameEdge();
if (inwardConnectedExit)
content.chromeOnlyExit = true;
if (win.connectedFrameMode && (win.isCenterPosition || inwardConnectedExit)) {
if (win.connectedFrameMode) {
win.startExit();
NotificationService.dismissNotification(notificationData);
} else {

View File

@@ -43,6 +43,7 @@ QtObject {
popupComponent: Component {
NotificationPopup {
onExitFinished: manager._onPopupExitFinished(this)
onExitStarted: manager._onPopupExitStarted(this)
onPopupHeightChanged: manager._onPopupHeightChanged(this)
onPopupChromeGeometryChanged: manager._onPopupChromeGeometryChanged(this)
}
@@ -263,9 +264,14 @@ QtObject {
}
function _popupChromeVisibleFraction(p) {
if (p.exiting && p.popupChromeReleaseProgress)
return 1 - _chromeReleaseTailProgress(p.popupChromeReleaseProgress());
if (!p.exiting && p.popupChromeOpenProgress)
if (p.popupChromeReleaseProgress) {
const rel = p.popupChromeReleaseProgress();
if (p.exiting)
return Math.max(0, 1 - rel);
if (rel > 0)
return p.swipeDismissTowardEdge ? Math.max(0, 1 - rel) : 1 - _chromeReleaseTailProgress(rel);
}
if (p.popupChromeOpenProgress)
return _clamp01(p.popupChromeOpenProgress());
return 1;
}
@@ -389,6 +395,7 @@ QtObject {
ConnectedModeState.clearNotificationState(screenName);
return;
}
const trailing = chromeCandidates.length > 1 ? _trailingChromeWindow(chromeCandidates) : null;
let active = chromeCandidates;
if (chromeCandidates.length > 1) {
@@ -396,6 +403,7 @@ QtObject {
if (reserving.length > 0)
active = reserving;
}
let minX = Infinity;
let minY = Infinity;
let maxXEnd = -Infinity;
@@ -449,6 +457,12 @@ QtObject {
_repositionAll();
}
function _onPopupExitStarted(p) {
if (!p || popupWindows.indexOf(p) === -1)
return;
_repositionAll();
}
function _onPopupExitFinished(p) {
if (!p)
return;