mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-03 19:12:11 -04:00
fix(DankSlideout): Improve visibility handling and state management
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Quickshell
|
import Quickshell
|
||||||
@@ -6,8 +7,6 @@ import qs.Common
|
|||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@@ -25,27 +24,28 @@ PanelWindow {
|
|||||||
property string title: ""
|
property string title: ""
|
||||||
property alias container: contentContainer
|
property alias container: contentContainer
|
||||||
property real customTransparency: -1
|
property real customTransparency: -1
|
||||||
|
property bool mappedVisible: false
|
||||||
signal aboutToHide
|
signal aboutToHide
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
visible = true
|
mappedVisible = true;
|
||||||
isVisible = true
|
Qt.callLater(() => { isVisible = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
aboutToHide()
|
aboutToHide();
|
||||||
isVisible = false
|
isVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
hide()
|
hide();
|
||||||
} else {
|
} else {
|
||||||
show()
|
show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: isVisible
|
visible: root.mappedVisible
|
||||||
screen: modelData
|
screen: modelData
|
||||||
|
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
@@ -83,15 +83,15 @@ PanelWindow {
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
width: alignedWidth
|
width: root.alignedWidth
|
||||||
height: alignedHeight
|
height: root.alignedHeight
|
||||||
|
|
||||||
property real slideOffset: alignedWidth
|
property real slideOffset: root.alignedWidth
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root
|
target: root
|
||||||
function onIsVisibleChanged() {
|
function onIsVisibleChanged() {
|
||||||
slideContainer.slideOffset = root.isVisible ? 0 : slideContainer.width
|
slideContainer.slideOffset = root.isVisible ? 0 : slideContainer.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ PanelWindow {
|
|||||||
easing.type: Easing.OutCubic
|
easing.type: Easing.OutCubic
|
||||||
|
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if (!running && !isVisible) {
|
if (!running && !root.isVisible) {
|
||||||
root.visible = false
|
root.mappedVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ PanelWindow {
|
|||||||
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
||||||
readonly property real effectiveTransparency: customTransparency >= 0 ? customTransparency : SettingsData.popupTransparency
|
readonly property real effectiveTransparency: root.customTransparency >= 0 ? root.customTransparency : SettingsData.popupTransparency
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|||||||
Reference in New Issue
Block a user