1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-19 17:45:21 -04:00

feat(popouts): implement hover popout functionality

This commit is contained in:
purian23
2026-06-12 23:19:29 -04:00
parent 3701b3d7a3
commit fc72b6d779
12 changed files with 1251 additions and 315 deletions
+44 -2
View File
@@ -13,6 +13,7 @@ PanelWindow {
WlrLayershell.namespace: layerNamespace
property bool isVisible: false
property bool hoverDismissEnabled: false
property var targetScreen: null
property var modelData: null
property bool triggerUsesOverlayLayer: false
@@ -39,6 +40,24 @@ PanelWindow {
isVisible = false;
}
function hideFromHoverDismiss() {
hoverDismissEnabled = false;
slideAnimation.duration = Math.round(Theme.expressiveDurations.expressiveDefaultSpatial);
hide();
}
function cancelHoverDismiss() {
hoverDismissTracker.cancelPending();
}
function containsGlobalPoint(gx, gy) {
if (!isVisible || !modelData)
return false;
const padding = 24;
const topLeft = slideContainer.mapToItem(null, 0, 0);
return gx >= topLeft.x - padding && gx < topLeft.x + slideContainer.width + padding && gy >= topLeft.y - padding && gy < topLeft.y + slideContainer.height + padding;
}
function toggle() {
if (isVisible) {
hide();
@@ -60,6 +79,27 @@ PanelWindow {
color: "transparent"
MouseArea {
anchors.fill: parent
z: -1
acceptedButtons: Qt.NoButton
hoverEnabled: true
onPositionChanged: mouse => {
const gp = mapToItem(null, mouse.x, mouse.y);
PopoutManager.updateHoverCursor(gp.x, gp.y);
}
}
HoverDismissTracker {
id: hoverDismissTracker
anchors.fill: parent
enabled: root.hoverDismissEnabled && root.isVisible
shouldDismiss: function () {
return !PopoutManager.cursorOverBar(PopoutManager.hoverCursorGlobalX, PopoutManager.hoverCursorGlobalY);
}
onDismissRequested: root.hideFromHoverDismiss()
}
readonly property bool slideoutBlurActive: root.visible && BlurService.enabled && Theme.connectedSurfaceBlurEnabled
WlrLayershell.layer: (triggerUsesOverlayLayer || CompositorService.framePeerSurfacesUseOverlayForScreen(modelData)) ? WlrLayershell.Overlay : WlrLayershell.Top
@@ -104,8 +144,10 @@ PanelWindow {
easing.type: Easing.OutCubic
onRunningChanged: {
if (!running && !root.isVisible) {
root.mappedVisible = false;
if (!running) {
if (!root.isVisible)
root.mappedVisible = false;
slideAnimation.duration = 450;
}
}
}