diff options
-rw-r--r-- | sysui/centerconsole/MainContentArea.qml | 15 | ||||
-rw-r--r-- | sysui/centerconsole/WidgetDrawer.qml | 44 |
2 files changed, 34 insertions, 25 deletions
diff --git a/sysui/centerconsole/MainContentArea.qml b/sysui/centerconsole/MainContentArea.qml index 3a221758..b664243c 100644 --- a/sysui/centerconsole/MainContentArea.qml +++ b/sysui/centerconsole/MainContentArea.qml @@ -90,7 +90,7 @@ Item { // widgets will reparent themselves to the active application slot when active activeApplicationParent: activeApplicationSlot moveBottomWidgetToDrawer: !widgetDrawer.showingHomePage - widgetDrawer: widgetDrawerSlot + widgetDrawer: widgetDrawer.slot popupParent: root.popupParent exposedRectTopMargin: launcher.y + Sizes.dp(Config.launcherHeight) exposedRectBottomMargin: root.activeAppBottomMargin @@ -123,16 +123,9 @@ Item { height: homePage.rowHeight anchors.bottom: homePage.bottom - dragEnabled: false - visible: !showingHomePage && !widgetDrawerSlot.empty - - Item { - id: widgetDrawerSlot - width: homePage.widgetWidth - height: homePage.rowHeight - anchors.horizontalCenter: widgetDrawer.horizontalCenter - readonly property bool empty: children.length === 0 - } + slotWidth: homePage.widgetWidth + slotHeight: homePage.rowHeight + visible: !showingHomePage && !widgetDrawer.empty property bool showingHomePage: !root.applicationModel || root.applicationModel.activeAppInfo === null onShowingHomePageChanged: { diff --git a/sysui/centerconsole/WidgetDrawer.qml b/sysui/centerconsole/WidgetDrawer.qml index 4eb549ed..a9334dc9 100644 --- a/sysui/centerconsole/WidgetDrawer.qml +++ b/sysui/centerconsole/WidgetDrawer.qml @@ -49,31 +49,47 @@ import shared.Sizes 1.0 SomeItem {} } */ -MouseArea { +Item { id: root - drag.target: root - drag.axis: Drag.XAxis - drag.filterChildren: dragEnabled - drag.minimumX: d.layoutMirroringEnabled ? - d.widthWithoutStick : 0 - drag.maximumX: d.layoutMirroringEnabled ? 0 : d.widthWithoutStick - - opacity: 0.5 + 0.5 * (1 - Math.abs(root.x) / d.widthWithoutStick) - - // Whether the drag behavior is enabled. - property bool dragEnabled: true // how much of it should be sticking out from the right side of the display when // the widget drawer has been closed readonly property real stickOutWidth: Sizes.dp(90) + property Item slot: widgetDrawerSlot + property alias slotWidth: widgetDrawerSlot.width + property alias slotHeight: widgetDrawerSlot.height + property alias empty: widgetDrawerSlot.empty + // true if in full view, false if it's tucked away on the right side of the display property bool open: true onOpenChanged: d.applyOpenState() + opacity: 0.5 + 0.5 * (1 - Math.abs(root.x) / d.widthWithoutStick) + + Item { + id: widgetDrawerSlot + anchors.horizontalCenter: root.horizontalCenter + readonly property bool empty: children.length === 0 + } + + MouseArea { + id: handl + width: root.stickOutWidth + height: root.height + anchors.left: root.left + + drag.target: root + drag.axis: Drag.XAxis + + drag.minimumX: d.layoutMirroringEnabled ? - d.widthWithoutStick : 0 + drag.maximumX: d.layoutMirroringEnabled ? 0 : d.widthWithoutStick + } + Connections { - target: drag + target: handl.drag onActiveChanged: { - if (root.drag.active) { + if (handl.drag.active) { d.lastX = root.x; d.direction = 0; d.dragging = true; @@ -102,7 +118,7 @@ MouseArea { property int direction property bool dragging: false readonly property real minimumDrag: Sizes.dp(90) - readonly property real widthWithoutStick: root.width - stickOutWidth + readonly property real widthWithoutStick: root.width - root.stickOutWidth readonly property bool layoutMirroringEnabled: root.LayoutMirroring.enabled onLayoutMirroringEnabledChanged: { |