Fix zoom gesture focal point
ClosedPublic

Authored by alvinhochun on Oct 7 2017, 7:28 AM.

Details

Summary

Came across this while working on D8121 (native touch gestures for Mac).

Currently, the pinch zoom gesture zooms into a wrong focus point (it's always the center). This fixes it to actually zoom into the point your touch position is located at.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
poke1024 created this revision.Oct 7 2017, 7:28 AM
alvinhochun added a subscriber: alvinhochun.EditedOct 7 2017, 9:45 AM

While you are at it, can you also fix the panning offset part of the gesture (and also the three-finger pan gesture)? It seems to be double of the actual movement. (Not a regression of this patch.)

@alvinhochun I saw that as well, but I wasn't sure what the reason was. Are you on a hidpi screen? Because I suspect this is a QT bug with wrong scaling in the touch screen coordinates when on hidpi. If you're experiencing this on hidpi as well, I can try a fix.

@alvinhochun I saw that as well, but I wasn't sure what the reason was. Are you on a hidpi screen? Because I suspect this is a QT bug with wrong scaling in the touch screen coordinates when on hidpi. If you're experiencing this on hidpi as well, I can try a fix.

I doubt it's related because it happens both with Qt's high DPI scaling on and off, and also happens when I set the Windows display scaling to 100%. Also it wouldn't make sense that it can get the coordinates properly for calculating the centre point.

poke1024 updated this revision to Diff 20444.Oct 7 2017, 2:33 PM

Panning works now; (the code is not beautiful but robust).

No... this is worse than before...

For me on Windows, two finger pinch zoom/pan hasn't changed (obviously), but three-finger pan now jumps a bit when starting the gesture. The offset is still doubled, which means its not actually fixed.

I'd say revert to the original patch, and figure out the pan issue later in a separate task.

(Small correction to the original description: The existing zoom centre point is not always at the center of the canvas, but offset relative to the window position.)

dkazakov requested changes to this revision.Oct 23 2017, 10:12 AM
dkazakov added a subscriber: dkazakov.

I will mark the patch as "needs changes" so it would not be present in"must review" list :)

This revision now requires changes to proceed.Oct 23 2017, 10:12 AM
alvinhochun commandeered this revision.Dec 12 2017, 11:45 AM
alvinhochun updated this revision to Diff 23800.
alvinhochun added a reviewer: poke1024.

Revert to previous diff

This revision was automatically updated to reflect the committed changes.