How to transform the position of a CanvasItem in a SubViewport to the position of a CanvasItem in a CanvasLayer

Godot Version



I’m working on a pixel art game, because the pixel font is too large in the small viewport, so I set the root viewport size to 640 * 360 to display the UI, and the SubViewport size to 320 * 180 to display the main game scene, so the scale of the SubViewportContainer is 2

Here’s a simple scene tree example
The World is the main game scene, the Player can move around, and the Camera2D is the child node of the Player. The Player moves in the SubViewport, while the CanvasLayer remains in position in the root viewport

ItemDebugInfoLabel is used to display the debugging information of the Item, and the following picture is a simple display of the effect.

I want the ItemDebugInfoLabel to remain in the same relative position with the Item in the CanvasLayer when the Player moves, but I don’t know how to transform the position

I’ve looked up some documentation, like Viewport and canvas transforms, but still don’t have a clue, please help me