Optional 'Auto Fit Selected Object'

When we select Objects in Tiled, the view automatically positions itself in an attempt to center/fit the Object into view. Now, possibly due to a related bug regarding the Mini-Map that I will soon report, this adjustment doesn’t work accurately when Image Objects are concerned. This is very apparent when the Image Objects’ source image resolution is big. Oftentimes, the view centers at a lower position, and sometimes it completely moves the the view so far out that you no longer see the Image Object.

Partly because of this bug I was wondering if it would be better to have this auto-fit as an option in the Preferences, or a tickbox in the menu, or a toolbar button that toggles ‘Auto Fit Selected Objects’.

Another reason why this would be useful is when editing a fairly large map, the current view is important to retain despite the object selection. Sometimes, the object selection is to only change attributes of the object rather than intending to view or move them. When the auto-fit kicks in, you have to scroll back to the original view you had, or remember the object that you were focused on before you selected the last object.

Thanks for reading!

I agree jumping the view to the selected object can be disruptive. I’d prefer to improve the behavior rather than including an option, but I can’t think of a good option since common patterns, like using double-click or a modifier, are taken for other actions like renaming the object or changing selection behavior respectively. Maybe it makes sense to jump to the object on double-click, instead of renaming? Or maybe we should have a completely separate shortcut to “focus on selected objects”? I guess that would be the way to go.

And of course, we should fix the camera movement to actually work properly. It was originally written for rectangle objects, but as time went by we added tile objects, polygons and object rotation, all of which are still not properly taken into account when determining the location to center on. I’ll look into fixing this soon.

I think that if you’d like to avoid ‘options’ then yes, I agree that ‘focus on selected objects’ would be very intuitive. Various apps would map either the F/Shift+F, or A/Shift+A.

But speaking of ‘options’, I sure would like to encourage you to have a look at ‘toolbar options’, something that you might find in apps like Photoshop. The ‘toolbar options’ are ‘live’ so that you don’t have to go into a menu; these options simply toggle a mode in which other actions are contextualised. In Photoshop (forgive me if you already know this), when in the Move Tool, you can click an options like ‘Auto-Select’ and clicking on the canvas will modify the action as though you were holding down the Ctrl key (which is the modifier to select layers).

Personally, I don’t tend to prefer options when I have to dig into menus, but contextual ‘live’ options are a pretty neat idea. :slight_smile:

Thanks again, Bjorn.

I agree and of course Photoshop is not the only tool that features this, but so do GIMP, Inkscape and Krita. And in fact, a context-sensitive tool bar was also added in Tiled in version 1.1. Though there is certainly room for more options in that tool bar.

But, those are options specific to the context of the selected tool, which would be outside the scope of a “focus on selected objects” action or an option to automatically do this whenever an object is clicked in the Objects view. Though certainly a button or two could be added in the local tool bar instead.

And in fact, a context-sensitive tool bar was also added in Tiled in version 1.1.

Man, I’m an idiot, of course! I guess I just didn’t connect it with I was writing about. I think it’s getting late. :sleeping: