WhirlyGlobe
WhirlyGlobe copied to clipboard
Excessive Momentum in WhirlyGlobe
http://www.mulps.pw/temp/WhirlyGlobeMomentum.mp4
In the video the small circle around the cursor shows when the mouse button is pressed. Please mentally replace the pressed mouse button with a finger in contact with touch screen.
Pretty self-explanatory. In real life, when rotating an object with your finger, if you stop moving your finger while in contact with the object the object will not continue to rotate. You can hold your finger steady to "brake" the motion.
Perhaps the WhirlyGlobe momentum code could record the last fraction of a second of the finger speed to calculate the momentum motion.
It's using the velocity from the touch. I added a little debugging code and I can see there's always a velocity even when it seems like there shouldn't be.
You could try adding a cutoff, but it might need to be screen size specific. Line 313 in PanDelegateFixed.mm. Just set vel.x and vel.y to 0.0 if it's a below a certain cutoff. I couldn't say what that cutoff is, though.
Thanks, Steve.
Apple's velocity code is a bit primitive. I have edited PanDelegateFixed.mm to look at the speed of the last 10th of a second of movement. It is not perfect but I feel it is a vast improvement.
Here is a new demo video of the solution:
http://www.mulps.pw/temp/WhirlyGlobeMomentumNew.mp4
Cool. Thanks!
My pleasure!