Center of the map

How can I see the center of the map when i load it in? it would be very helpful if i knew exactly where the center was so i could start from there.

If you press Ctrl+/, it will fit the entire map into the view (also View > Fit Map in View). Then, the center of the map is in the center of the view.

Thank you!

In case you want to centre on the map without fitting it in view (keeping your current zoom), I wrote a script to do this a while back:

var action = tiled.registerAction("CenterView", function(action) {
	var map = tiled.activeAsset;
	if(!map || !map.isTileMap) return;
	if(map.infinite)
		tiled.mapEditor.currentMapView.centerOn(0, 0);
	else
		tiled.mapEditor.currentMapView.centerOn(map.width/2 * map.tileWidth, map.height/2*map.tileHeight);
});

action.text = "Center View on Map";
action.shortcut = "Home";
tiled.extendMenu("View", [
    { action: "CenterView", before: "FitInView" }
]);

Save this as CenterView.js into your extensions directory, and it’ll place a “Center View on Map” menu item right above “Fit Map in View”. It also has the Home key as the default shortcut, but you can change this in Preferences > Keyboard, or change/remove that line in the script.

For infinite maps, it centres on 0,0, if you use infinite maps and would prefer other behaviour (centering on the bounding box of currently placed tiles, perhaps?), let me know and I’ll make the change. I haven’t used infinite maps myself much so I don’t know what works best for them.

1 Like