Change Origin of tile map layer

Godot Version

4.4

Question

Hello I’ve tried to get an awnser to this question before however i think i greatly overcomplicated my question so i set up a quick example project to help with it.
This is my SceneTree:

The problem which i’m encountering is that when moving the position of the TileMapLayer (which in this case is simply done with a control node anchored to the center of the screen) the TileMapLayer will vissually move the content of the tile map to this position but not the acctual tile itself.

So when i run this scene and check for the tiles of that tile map using:

func _process(delta: float) -> void:
	var pos = get_global_mouse_position()
	var tile = $TileMapLayer.local_to_map(pos)
	print(tile)

The result will look like this:


With the tile (0,0) being in the top left of the screen and so on.

My question is:
Is there a way to Chane the origin of the tile map so that the tiles will always align with the visual content?

or maybe do i need a different function which will return me the coordinates of the tile map relative to its position.
I found this post on here:

Which i believe would solve my problem however i think the

local_to_world()

function has been removed.

Thanks for any Help.

Found the answer for this the Linked post had the solution i just didnt understand it fully:

In my example the code needs one extra line:

func _process(delta: float) -> void:
	var pos = get_global_mouse_position()
	var tilePosition = $TileMapLayer.to_local(pos)
	var tile = $TileMapLayer.local_to_map(tilePosition)
	print(tile)

converting the global mouse position to the local position of the tile map fixes the issue.