Commit 3bb66583 authored by DonLakeFlyer's avatar DonLakeFlyer

Better usability with touch

parent 5e9e8b81
...@@ -9,7 +9,7 @@ import QGroundControl.Palette 1.0 ...@@ -9,7 +9,7 @@ import QGroundControl.Palette 1.0
Rectangle { Rectangle {
id: _root id: _root
width: label.contentWidth + (_diameter * 2.5) + (_border * 4) width: label.contentWidth + (_diameter * 2.5) + (_border * 4)
height: label.height * 2.5 height: Math.max(ScreenTools.isMobile ? ScreenTools.minTouchPixels : 0, label.height * 2.5)
radius: height /2 radius: height /2
color: qgcPal.window color: qgcPal.window
...@@ -49,31 +49,37 @@ Rectangle { ...@@ -49,31 +49,37 @@ Rectangle {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
smooth: false smooth: false
mipmap: false mipmap: false
color: qgcPal.text color: qgcPal.text
cache: false cache: false
source: "/res/ArrowRight.svg" source: "/res/ArrowRight.svg"
} }
MouseArea { }
id: sliderDragArea
anchors.fill: parent MouseArea {
drag.target: slider id: sliderDragArea
drag.axis: Drag.XAxis anchors.leftMargin: -ScreenTools.defaultFontPixelWidth * 15
drag.minimumX: _border anchors.fill: slider
drag.maximumX: _maxXDrag drag.target: slider
drag.axis: Drag.XAxis
drag.minimumX: _border
drag.maximumX: _maxXDrag
preventStealing: true
property real _maxXDrag: _root.width - (_diameter + _border)
property bool dragActive: drag.active
property real _dragOffset: 1
property real _maxXDrag: _root.width - (_diameter + _border) onPressed: {
property bool dragActive: drag.active mouse.x
}
onDragActiveChanged: { onDragActiveChanged: {
if (!sliderDragArea.drag.active) { if (!sliderDragArea.drag.active) {
if (slider.x > _maxXDrag - _border) { if (slider.x > _maxXDrag - _border) {
_root.accept() _root.accept()
}
slider.x = _border
} }
slider.x = _border
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment