Global mouse click position and camera view size

I’m looking for a formula. When the camera zoom is no longer the default Vector(1,1), I get an offset if I go through the global mouse position and turn it into the coordinates of the out tilemap_layer via local_to_map(to_local). I wish I could have a formula that would perfectly align the rendered position of the set_cell with my mouse click position. For the node tree, I have two CanvasLayer nodes of the same level, one of which holds the camera node and one holds the control node, and I’m getting the global mouse position of the control node.

Translated with DeepL.com (free version)