RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.
http://rptools.net
GNU Affero General Public License v3.0
801 stars 262 forks source link

Round Zoom In / Zoom Out levels #1407

Open Merudo opened 4 years ago

Merudo commented 4 years ago

Is your feature request related to a problem? Please describe. When zooming in / zooming out (either from menu or via the mouse scrolling button), the zoom levels have many decimals.

Example: Zoom Up: 1.0 -> 1.155625 -> 1.242296875 -> 1.3354691406246 Zoom Down: 1.0 -> 0.9302325581395349 -> 0.8653326122228232

These zoom levels create rounded off errors, which can result in odd glitches (example 1; example 2)

Describe the solution you'd like The zoom levels remain keep 2 decimals, for example:

Zoom Up: 1.0 -> 1.16 -> 1.25 -> 1.34 Zoom Down: 1.0 -> 0.93 -> 0.87

This will reduce the number of graphical glitches.

Describe alternatives you've considered Fixing these round off errors for any zoom level would be preferred.

Azhrei commented 4 years ago

To eliminate round off, the decimal fraction must be composed of binary fractions, so numbers like ½ and ½ + ⅛ - ¼ would incur no round off... I’m not sure simply rounding the base 10 result is going to help with whatever “glitches” you’re referring to.

Particularly since rounding it off means that zooming large amounts out and back in will likely cause the zoom level to not be consistent. (So starting at 1.0 and zooming way out, then back in, will not result in 1.0.)

Have you already tested a fix?

Phergus commented 4 years ago

Having consistent zoom levels as Azhrei mentioned is important and the solution is, as he says, to use binary fractions. There was a discussion about this way back at the beginning because the first implementation wouldn't allow you to get back to 100% after zooming in and out.