diff options
Diffstat (limited to 'src/controls/Slider.qml')
-rw-r--r-- | src/controls/Slider.qml | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 459fe54cc..d0644b4cc 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -239,28 +239,28 @@ Control { return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val)) } - function updateHandlePosition(mouse) { + function updateHandlePosition(mouse, force) { var pos, overThreshold if (__horizontal) { pos = clamp (mouse.x + clickOffset - fakeHandle.width/2) overThreshold = Math.abs(mouse.x - pressX) >= Settings.dragThreshold if (overThreshold) preventStealing = true - if (overThreshold || !Settings.hasTouchScreen) + if (overThreshold || force) fakeHandle.x = pos } else if (!__horizontal) { pos = clamp (mouse.y + clickOffset- fakeHandle.height/2) overThreshold = Math.abs(mouse.y - pressY) >= Settings.dragThreshold if (overThreshold) preventStealing = true - if (overThreshold || !Settings.hasTouchScreen) + if (overThreshold || force) fakeHandle.y = pos } } onPositionChanged: { if (pressed) - updateHandlePosition(mouse) + updateHandlePosition(mouse, preventStealing) var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y) handleHovered = fakeHandle.contains(Qt.point(point.x, point.y)) @@ -276,10 +276,11 @@ Control { } pressX = mouse.x pressY = mouse.y - updateHandlePosition(mouse) + updateHandlePosition(mouse, !Settings.hasTouchScreen) } onReleased: { + updateHandlePosition(mouse, Settings.hasTouchScreen) // If we don't update while dragging, this is the only // moment that the range is updated. if (!slider.updateValueWhileDragging) |