diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-08-07 11:41:53 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-09-08 13:52:30 +0200 |
commit | cdd13a4ca9685da5f9ab7c792d90ff0b2d788a86 (patch) | |
tree | a3f70e3f069da8b4d4cf22e4d17e1ca6f19b8407 /src/controls/Private | |
parent | 26f69ece4d1d4245f903ba484c1fa3c6d844824a (diff) | |
download | qtquickcontrols-cdd13a4ca9685da5f9ab7c792d90ff0b2d788a86.tar.gz |
TextHandle: fix mapping of touch position to handle position
Regardless of where the user drags on the mouse area (which
can be big for the user to hit it), you should continue dragging
on the selection where it is, not jump the location under the finger.
This patch will change offset to be the distance from the text position
under the handle to the touch point, so regardless where the user
touches the handle, the selection will not jump when the drag starts.
Change-Id: I849e42c5e94f44aec355224a9db146bcdf22d43f
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/Private')
-rw-r--r-- | src/controls/Private/TextHandle.qml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/controls/Private/TextHandle.qml b/src/controls/Private/TextHandle.qml index 558d0fa3..85666ea4 100644 --- a/src/controls/Private/TextHandle.qml +++ b/src/controls/Private/TextHandle.qml @@ -80,7 +80,11 @@ Loader { property point offset onPressed: { pressX = mouse.x - offset = Qt.point(x + mouse.x, y + mouse.y) + var handleRect = editor.positionToRectangle(handle.position) + var centerX = handleRect.x + (handleRect.width / 2) + var centerY = handleRect.y + (handleRect.height / 2) + var center = mapFromItem(editor, centerX, centerY) + offset = Qt.point(mouseX - center.x, mouseY - center.y) } onReleased: preventStealing = false onMouseXChanged: { |