Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
3bb66583
Commit
3bb66583
authored
Mar 11, 2017
by
DonLakeFlyer
Browse files
Better usability with touch
parent
5e9e8b81
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/QmlControls/SliderSwitch.qml
View file @
3bb66583
...
@@ -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
}
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment