mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-28 14:05:21 -04:00
feat(HoverMode): implement hover popout & launcher functionality in all modes
- New Hover toggle found in DankBar Settings - New Hover to Reveal Launcher in FrameTab Settings
This commit is contained in:
@@ -24,6 +24,8 @@ Item {
|
||||
property list<real> animationExitCurve: Theme.variantPopoutExitCurve
|
||||
property bool suspendShadowWhileResizing: false
|
||||
property bool shouldBeVisible: false
|
||||
property bool hoverDismissEnabled: false
|
||||
property bool hoverDismissSuspended: false
|
||||
property var customKeyboardFocus: null
|
||||
property bool backgroundInteractive: true
|
||||
property bool contentHandlesKeys: false
|
||||
@@ -82,6 +84,8 @@ Item {
|
||||
readonly property real alignedY: impl.item ? impl.item.alignedY : 0
|
||||
readonly property real alignedWidth: impl.item ? impl.item.alignedWidth : 0
|
||||
readonly property real alignedHeight: impl.item ? impl.item.alignedHeight : 0
|
||||
readonly property real renderedAlignedY: impl.item ? (impl.item.renderedAlignedY ?? impl.item.alignedY) : 0
|
||||
readonly property real renderedAlignedHeight: impl.item ? (impl.item.renderedAlignedHeight ?? impl.item.alignedHeight) : 0
|
||||
readonly property real maskX: impl.item ? impl.item.maskX : 0
|
||||
readonly property real maskY: impl.item ? impl.item.maskY : 0
|
||||
readonly property real maskWidth: impl.item ? impl.item.maskWidth : 0
|
||||
@@ -172,6 +176,36 @@ Item {
|
||||
impl.item.close();
|
||||
}
|
||||
|
||||
function cancelHoverDismiss() {
|
||||
if (impl.item?.cancelHoverDismiss)
|
||||
impl.item.cancelHoverDismiss();
|
||||
}
|
||||
|
||||
// Fade out in place during morph switch transitions.
|
||||
function beginSupersededClose() {
|
||||
if (impl.item?.beginSupersededClose)
|
||||
impl.item.beginSupersededClose();
|
||||
}
|
||||
|
||||
function closeFromHoverDismiss() {
|
||||
if (hoverDismissSuspended)
|
||||
return;
|
||||
hoverDismissEnabled = false;
|
||||
// Enable animations using standard Theme-bound popout motion to preserve bindings.
|
||||
if (impl.item)
|
||||
impl.item.animationsEnabled = true;
|
||||
for (const prop of ["dashVisible", "notificationHistoryVisible"]) {
|
||||
if (root[prop] !== undefined) {
|
||||
root[prop] = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (impl.item)
|
||||
impl.item.close();
|
||||
else
|
||||
close();
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
(shouldBeVisible || _pendingOpen) ? close() : open();
|
||||
}
|
||||
@@ -210,6 +244,20 @@ Item {
|
||||
impl.item.updateSurfacePosition();
|
||||
}
|
||||
|
||||
function containsGlobalPoint(gx, gy) {
|
||||
if (!screen)
|
||||
return false;
|
||||
const presented = shouldBeVisible || (impl.item?.isClosing ?? false);
|
||||
if (!presented)
|
||||
return false;
|
||||
const padding = 24;
|
||||
const x = alignedX - padding;
|
||||
const y = renderedAlignedY - padding;
|
||||
const w = alignedWidth + padding * 2;
|
||||
const h = renderedAlignedHeight + padding * 2;
|
||||
return gx >= x && gx <= x + w && gy >= y && gy <= y + h;
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: impl
|
||||
active: root.screen !== null
|
||||
@@ -261,6 +309,8 @@ Item {
|
||||
it.screen = Qt.binding(() => root.screen);
|
||||
it.effectiveBarPosition = Qt.binding(() => root.effectiveBarPosition);
|
||||
it.effectiveBarBottomGap = Qt.binding(() => root.effectiveBarBottomGap);
|
||||
it.hoverDismissEnabled = Qt.binding(() => root.hoverDismissEnabled);
|
||||
it.hoverDismissSuspended = Qt.binding(() => root.hoverDismissSuspended);
|
||||
|
||||
it.shouldBeVisible = root.shouldBeVisible;
|
||||
if (root._primeContent && typeof it.primeContent === "function")
|
||||
|
||||
Reference in New Issue
Block a user