Skip to content

Commit

Permalink
[fingerterm] Fix selection offset. Contributes JB#49213
Browse files Browse the repository at this point in the history
When the text area is offset by the keyboard, the selection needs to
take the offset into account, otherwise the vertical position of the
selection doesn't match the location of the user's finger.
  • Loading branch information
llewelld authored and David Llewellyn-Jones committed Feb 5, 2021
1 parent 741222c commit 751e47a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions qml/Main.qml
Expand Up @@ -134,14 +134,16 @@ Item {

onPressed: {
touchPoints.forEach(function (touchPoint) {
if (multiTouchArea.firstTouchId == -1) {
multiTouchArea.firstTouchId = touchPoint.pointId;
var key = vkb.keyAt(touchPoint.x, touchPoint.y);
if ((key == null) || (!vkb.active)) {
if (multiTouchArea.firstTouchId == -1) {
multiTouchArea.firstTouchId = touchPoint.pointId;

//gestures c++ handler
textrender.mousePress(touchPoint.x, touchPoint.y);
//gestures c++ handler
textrender.mousePress(touchPoint.x, touchPoint.y - textrender.y);
}
}

var key = vkb.keyAt(touchPoint.x, touchPoint.y);
if (key != null) {
key.handlePress(multiTouchArea, touchPoint.x, touchPoint.y);
}
Expand All @@ -152,7 +154,7 @@ Item {
touchPoints.forEach(function (touchPoint) {
if (multiTouchArea.firstTouchId == touchPoint.pointId) {
//gestures c++ handler
textrender.mouseMove(touchPoint.x, touchPoint.y);
textrender.mouseMove(touchPoint.x, touchPoint.y - textrender.y);
}

var key = multiTouchArea.pressedKeys[touchPoint.pointId];
Expand Down Expand Up @@ -181,7 +183,7 @@ Item {
}

//gestures c++ handler
textrender.mouseRelease(touchPoint.x, touchPoint.y);
textrender.mouseRelease(touchPoint.x, touchPoint.y - textrender.y);
multiTouchArea.firstTouchId = -1;
}

Expand Down Expand Up @@ -241,7 +243,7 @@ Item {
fontPointSize: util.fontSize
opacity: (util.keyboardMode == Util.KeyboardFade && vkb.active) ? 0.3
: 1.0
allowGestures: (!vkb.active || util.keyboardMode == Util.KeyboardFixed)
allowGestures: (!vkb.active || util.keyboardMode !== Util.KeyboardFade)
&& !menu.showing && !urlWindow.show
&& !aboutDialog.show && !layoutWindow.show

Expand Down

0 comments on commit 751e47a

Please sign in to comment.