rupl / bustashape

Collaborative, real-time artboards
https://bustashape.art
MIT License
5 stars 3 forks source link

Improve zooming origin #78

Closed rupl closed 7 years ago

rupl commented 8 years ago

This is an unsolved mystery leftover from #24, #32, and other issues. The center of the zoom should always be the center of the pinch. Hammer gives us the "center" of any gestures it registers, so working out the math to zoom correctly is (as it always has been) the main blocker to getting this right.

rupl commented 8 years ago

I had a thought and wanted to jot it down for later. The answer is within these three objects I think:

Currently scene_transform does NOT alter the SVGRect when I update these values, but it might be the way to properly calculate the math since SVGRect is bound to the SVG instead of the user view... its effective scale is always 1, so calculating distances at SVGRect in relation to Hammer's ev.center values might yield the right transform.

rupl commented 7 years ago

I almost can't believe it, but I finally got this right! 10 months... :bowtie:

@afragon this is another one that could use some thrashing to try and break it. Once it's in, I'm gonna start the code cleanup and that will be messy so I want these new features to have some eyes so I don't have to bugfix while I'm re-organizing code.

rupl commented 7 years ago

I can't take it any longer! I have to deploy this!