Simple-Draw icon indicating copy to clipboard operation
Simple-Draw copied to clipboard

Zoom towards the center of the screen

Open CactiChameleon9 opened this issue 3 years ago • 4 comments
trafficstars

This helps fix #138 and #166.

The old zoom behaviour means that when you zoom in after moving the canvas, you end up zooming away from what you were recently drawing. In other words, the center of the zoom was at (0, 0) or the original center of the image.

This PR fixes that by adjusting the canvas position based of how much is zoomed so that the zoom is focused towards the center of what you can see (the screen) - fixing any weirdness with the zoom that was after moving.

CactiChameleon9 avatar Aug 23 '22 09:08 CactiChameleon9

(forgot to remove the Log import I was using to help debug - fixed now)

CactiChameleon9 avatar Aug 23 '22 09:08 CactiChameleon9

@tibbi, Sorry to nag - but its been a week and I was wondering on the likelihood of this being merged? Thanks

CactiChameleon9 avatar Aug 30 '22 07:08 CactiChameleon9

I havent been working on this app lately, will take a look at it once Im here. I dont want to jump around everywhere. Thanks

tibbi avatar Aug 30 '22 13:08 tibbi

That makes perfect sense, thanks for the update :)

CactiChameleon9 avatar Aug 30 '22 17:08 CactiChameleon9

sorry but this is too glitchy, it is jumping around. You can easily move the canvas with panning gestures, so I think it works well as it is. Thanks though

tibbi avatar Oct 10 '22 14:10 tibbi

~~I found it to be perfectly fine?? No jumping or anything. I will test on a few other devices~~ Totally was not fine. Should really test code more before sending a PR.

CactiChameleon9 avatar Oct 12 '22 15:10 CactiChameleon9

BTW @tibbi, I did get this fixed. The main problem with what I had done is due to the limits on zooming - it caused odd jumpy behaviour as you described.

I currently have a fork over at CactiChameleon9/Simple-Drawish which includes this fix and a few other things.

See a74f4b8bb967f182606dee1de8501b19720a3368 and 8809286d370eb72e09143d872d0471fe57d4f08e for the implementation (note I have increased the min/max zoom, so you may way to use your original values)

I can format and send a single commit PR to simple draw if you wish?

CactiChameleon9 avatar Feb 04 '23 20:02 CactiChameleon9

ye, create a new PR for easy testing please

tibbi avatar Feb 05 '23 15:02 tibbi

@tibbi Done! BTW - would you like me to make a PR for any of the other features I listed in the CactiChameleon9/Simple-Drawish README.md

I already know you are not interested in a full screen option.

CactiChameleon9 avatar Feb 05 '23 17:02 CactiChameleon9

well, if something is reported and marked as bug/feature, you can create a PR for it

tibbi avatar Feb 05 '23 19:02 tibbi