ID:2090245
 
(See the best response by Ter13.)
I have a second map element that is 338x338 in size and I'm trying to add a 338x338 HUD element to the map using anchors like "WEST:0, SOUTH:0", but for some reason the image isn't positioned properly and I have to offset it 23 pixels from the south and west for it to fit as it should. The icon size of the game and the icon size of the map element are 64 if it matters.

Help appreciated.

Best response
Secondary maps center based on full tiles and stretch to the furthest right object and the furthest left object.

338/64 = 5.28125

The object occupies 384 pixels (6 tiles) since it overlaps into the sixth tile, but is only 338 pixels visually.

384-338 = 46

This means you have 46 pixels of excess space in the map element's renderable area.

In order to center the hud element inside that second map, you have to offset it by half of the excess space:

46/2 = 23

The secondary maps attempt to center on the tile area taken up by all objects inside of it, so that extra 23 pixels is completely intended and you have fixed the problem.
Ahhh ok, thank you. I just wanted to understand why.