AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 288 forks source link

Made flat perspective scroll more uniform #643

Closed JordanMunroe closed 6 years ago

JordanMunroe commented 6 years ago

Zooming in flat mode is buggy and inconsistent due to FocusDistIncrement, multiplying Delta by current FocusDist is much smoother and provides a more natural zoom experience.

ilexp commented 6 years ago

Hey there and thanks for your contribution!

@AdamsLair/duality-contributors Nothing much to review here code-wise, but maybe quickly check behavior of this change vs. current release for cases like:

Would be willing to merge if you give a thumbs up.

JordanMunroe commented 6 years ago

Good point, that can easily fixed by changing it to this.View.FocusDist += ((float)e.Delta / 1000f) * Math.Max(this.View.FocusDist, 0.1f); This ensures you can always scroll back from 0 RefDist. I've also tested to make sure it doesn't have any adverse effects with cameras at different Z positions.

This way of zooming makes it much easier to achieve high precision zoom without it drastically over-adjusting. I've also made some other changes in my personal build to improve panning at different zoom levels but I may need to test it out some more.

ilexp commented 6 years ago

Good point @SirePi, and thanks for the quick review! Appears to be fixed in the latest commit, and since this was the only change request, I think we're ready for merge here.

ilexp commented 6 years ago

Merged. Thanks! 🙂

ilexp commented 6 years ago

Package release in progress. Should be out there in about 20 minutes.