This commit is contained in:
2026-04-08 17:11:03 -07:00
parent 5613ae1d8c
commit e8982ba4ef
115 changed files with 659 additions and 7 deletions

View File

@@ -39,10 +39,15 @@ func _process(_delta: float) -> void:
if not current_scene:
return
var global_mouse_pos = get_viewport().get_mouse_position()
var camera = get_viewport().get_camera_2d()
# Use the scene's viewport (SubViewport), not the root viewport,
# so we get the correct Camera2D and properly account for zoom/position.
var scene_viewport = current_scene.get_viewport()
var camera = scene_viewport.get_camera_2d()
var global_mouse_pos: Vector2
if camera:
global_mouse_pos = camera.get_global_mouse_position()
else:
global_mouse_pos = scene_viewport.get_mouse_position()
# Find all SetPieces in current scene
var new_hovered: Array[SetPiece] = []
@@ -53,7 +58,7 @@ func _process(_delta: float) -> void:
new_hovered.append(piece)
# Sort by priority (highest first)
new_hovered.sort_custom(func(a, b): return b.priority > a.priority)
new_hovered.sort_custom(func(a, b): return b.priority < a.priority)
# Check if top piece changed
var new_top = new_hovered[0] if new_hovered.size() > 0 else null