Tiled: Add a way to reset the editor scrolling position to X=0, Y=0

Created on 15 Aug 2019  路  4Comments  路  Source: mapeditor/tiled

Hello,

Sorry if this has already been suggested. My main grip with Tiled is that I often scroll too much and end up "out of bounds" (like plus or minus huge horizontal/vertical value), and then I struggle to go to the exact position where my map is. My map is tile based (32x32), 80x10 tiles. Nothing special.

Maybe I'm missing something, but I couldn't find a way to easily reset the scrolling position.
Suggestion:

  • Make it so clicking the grey square between both scrollbars (at the bottom right) resets the scrolling position to 0,0.
  • And/or add a keyboard shortcut to reset the scrolling position to 0,0
  • And/or simply make it impossible to scroll far away from the map
feature good first issue usability

Most helpful comment

Thanks for the suggestion! I think it's not a good idea to prevent scrolling away entirely, but there should definitely be an easy way to get back to the origin both as a shortcut and some button in the UI.

I think using the little square in the bottom right is a nice idea, though I could also imagine using that as a clickable area for panning in both directions (but, I know this is already possible with middle-click and spacebar as well...).

All 4 comments

Thanks for the suggestion! I think it's not a good idea to prevent scrolling away entirely, but there should definitely be an easy way to get back to the origin both as a shortcut and some button in the UI.

I think using the little square in the bottom right is a nice idea, though I could also imagine using that as a clickable area for panning in both directions (but, I know this is already possible with middle-click and spacebar as well...).

I'd like to try taking this one if you don't mind.

My initial instinct is that src/tiled/mapview.cpp(h) or src/tiled/mapscene.cpp(h) would be where I need to look to implement this behavior? At least that seems like where the code for handling those events is at. I'm assuming the little square in question is defined in one of the .ui files, I can't seem to identify which one though.

This is really my first time contributing to someone else's project so any guidance or feedback is gladly accepted.

@cctechwiz Hmm, sorry for the late reply! I hope you'd still have time to look into this. Indeed the MapView class could implement the method. I think it would be good to add it as a menu item in the "View" menu, which can be edited in the mainwindow.ui file and handled in mainwindow.cpp (just check how some of the other actions are connected).

If you run into any other questions, also feel free to ask in the Tiled Discord channel.

We'll also need to decide what this action should do _exactly_. The request is to scroll to 0,0 but that's the top-left corner of the map. Even though this is the origin, I don't see that being very useful in general. Maybe it would be better to have an action that centers the map, zooming out so you will see the entire map? So a "Fit in View" action essentially. I think that'd also help @thomasgoldstein.

2206 was merged now, which I think should suffice for closing this issue. @thomasgoldstein, let us know if it doesn't.

Was this page helpful?
0 / 5 - 0 ratings