mapeditor / mapeditor/tiled

User-defined zoom levels

Open
#4,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12.9k
Forks
2k
Avg merge
4h 27m
Merged PRs (30d)
8

Description

For different tile sizes and art styles, as well as different screen resolutions, different zoom levels are more appropriate. Someone working with large tiles may want to have smaller zoom levels available as well as more steps in the low %s, and may not want the ability to zoom in beyond 200% or so, while someone working with pixel art may never want 150% blurring their art and may often want 500 or 600% (currently only possible in Tiled by typing those values in), while yet another user may want some zoom steps that correspond to the specific camera zooms in their game. Currently, Tiled has the same set of zoom steps for everyone, so useful zoom levels might not be easily available to users, while scrolling their mouse wheel to zoom takes through through a bunch of extra steps they never want.

I think a flexible way to address these differences in needs would be to allow users to specify the zoom steps Tiled will use while zooming.
Here's a screenshot from ImageGlass, showing their zoom settings. They have a drop-down for the interpolation method and, more relevant to this issue, a text box where users can enter a list of zoom steps (in percent) that the program will step through. They use semicolons as the separator, presumably to avoid ambiguity with the comma potentially used as a decimal separator. It's not beautiful, but it works well.
image
The initial value of this list could correspond to Tiled's current zoom steps, 1; 3; 6; 12; 25; 33; 50; 75; 100; 150; 200; 300; 400; 550; 800; 1100; 1600; 2300; 3200; 4500; 6400; 9000;12800; 18000; 25600 (does anyone actually use the upper third of this list? It feels like it must've been taken from a vector program). For my own needs (pixel art, mostly), I'd probably replace it with 6.25; 12.5; 25; 50; 100; 200; 300; 400; 500; 600; 700; 800, while someone working with 256px tiles might instead go for 0.78125; 1.5625; 3.125; 6.25; 12.5; 25; 50; 100; 200; 300 (1/128x, 1/64x... 1/2x, 1x, 2x, 3x)
This box should display a warning if its contents cannot be parsed into a valid list of zoom steps. If Tiled allows saving such an invalid list, then it should use the default steps while the user-provided list is invalid.

In Tiled, the smallest allowed zoom level is 1% and the zoom drop-downs only allow entering integer values. For smaller and more flexible zooms to be possible, Tiled would need to allow non-integer percentages, e.g. 0.2%, 33.3333%. Such values should be allowed in the text box where the steps are defined, as well as in the drop-downs. I imagine Qt would handle the decimal point (. or ,) based on the current locale, but if not, both should be considered valid.

Typing in zoom values in the zoom dropdown should continue to allow values that aren't listed in the steps. So if someone has a max zoom step of 200%, they should still be able to zoom to 1600% by typing it in. By allowing decimal values, it should also be possible to zoom to values below 1% even if one keeps the default step list.

A related problem is that people with mouse wheels that scroll in finer increments than 15 degrees cannot even use the pre-defined steps in Tiled (except through the zoom drop-down) because Tiled instead calculates the zoom based on the scroll amount and the current zoom level. While that may be appropriate for vector artwork, Tiled does everything in raster mode, and being able to easily get to step values like 100% is usually important. Tiled should provide the option to use the steps even when the scroll wheel events are fine-grained, perhaps by zooming only when the total scroll amount since the last zoom reaches 15 degrees. This option should perhaps be enabled by default, so everyone has the same starter zooming experience regardless of their hardware.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the editor's zoom-step handling, zoom dropdown input, and mouse-wheel zoom behavior. Define how user-configured percentage lists, decimal values, invalid input fallback, typed values, and fine-grained wheel events should interact. Done means configurable steps work consistently while preserving typed zoom values and providing validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.