diff options
author | Aleksei Korkov <akorkov@luxoft.com> | 2020-02-06 13:20:13 +0300 |
---|---|---|
committer | Aleksei Korkov <akorkov@luxoft.com> | 2020-02-06 13:39:55 +0000 |
commit | 01e92338e8171c65c2d3037fcf0cda94dcb32673 (patch) | |
tree | aa17178b6c286bd19e0165dd9a061f55cdefe90a /sysui | |
parent | 57114ad02ffdf2a14cad35593854266a87cf0293 (diff) |
[sysui] Fix draggin bottom widget in Right-to-left interface
- WidgetDrawer has custom dragging behavior and it was necessary to fix it for right-to-left mode
Fixes: AUTOSUITE-1460
Change-Id: Ic7be2c1a16c446e9f9156bcf84aab2c24c5539b7
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
Diffstat (limited to 'sysui')
-rw-r--r-- | sysui/centerconsole/WidgetDrawer.qml | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sysui/centerconsole/WidgetDrawer.qml b/sysui/centerconsole/WidgetDrawer.qml index cbbf65fe..4eb549ed 100644 --- a/sysui/centerconsole/WidgetDrawer.qml +++ b/sysui/centerconsole/WidgetDrawer.qml @@ -54,10 +54,10 @@ MouseArea { drag.target: root drag.axis: Drag.XAxis drag.filterChildren: dragEnabled - drag.minimumX: 0 - drag.maximumX: root.width - stickOutWidth + drag.minimumX: d.layoutMirroringEnabled ? - d.widthWithoutStick : 0 + drag.maximumX: d.layoutMirroringEnabled ? 0 : d.widthWithoutStick - opacity: 0.5 + 0.5*(1 - (root.x - drag.minimumX)/(drag.maximumX - drag.minimumX)) + opacity: 0.5 + 0.5 * (1 - Math.abs(root.x) / d.widthWithoutStick) // Whether the drag behavior is enabled. property bool dragEnabled: true @@ -102,12 +102,19 @@ MouseArea { property int direction property bool dragging: false readonly property real minimumDrag: Sizes.dp(90) + readonly property real widthWithoutStick: root.width - stickOutWidth + readonly property bool layoutMirroringEnabled: root.LayoutMirroring.enabled + + onLayoutMirroringEnabledChanged: { + d.dragging = true + d.applyOpenState() + } function applyOpenState() { if (root.open) { - root.x = root.drag.minimumX; + root.x = 0; } else { - root.x = root.drag.maximumX; + root.x = d.layoutMirroringEnabled ? - d.widthWithoutStick : d.widthWithoutStick; } } } @@ -115,7 +122,8 @@ MouseArea { if (!d.dragging) { return; } - if (x > d.lastX) { + let isDirectionForOpening = d.layoutMirroringEnabled ? (x < d.lastX) : (x > d.lastX) + if (isDirectionForOpening) { if (d.direction !== 1) { d.direction = 1; d.startX = x; |