diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 15:52:48 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 15:52:48 +0100 |
commit | 15a1d2a66e48324e1d560dc13b776627820f3999 (patch) | |
tree | 4c062545a4c1a750293b52d5c11258f9b4218a2a /UI/Camera.gd | |
parent | a495681453c97578cc4a408d6919c6879524a603 (diff) |
next commit
Diffstat (limited to 'UI/Camera.gd')
-rw-r--r-- | UI/Camera.gd | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/UI/Camera.gd b/UI/Camera.gd index 3009ed2..60bb46d 100644 --- a/UI/Camera.gd +++ b/UI/Camera.gd @@ -33,7 +33,7 @@ func _ready(): zoomed.emit(zoom) ) - Input.mouse_mode = Input.MOUSE_MODE_CONFINED + #Input.mouse_mode = Input.MOUSE_MODE_CONFINED func _input(event): @@ -43,12 +43,16 @@ func _input(event): (limit_bottom - limit_top) / get_rect().size.y > 1.0 ) if can_zoom_out: + var previous_mouse_position := get_global_mouse_position() var new_zoom = max(zoom.x - zoom_step, zoom_min) zoom = Vector2(new_zoom, new_zoom) + global_position += previous_mouse_position - get_global_mouse_position() zoomed.emit(zoom) if event.is_action("camera_zoom_in"): + var previous_mouse_position := get_global_mouse_position() var new_zoom = min(zoom.x + zoom_step, zoom_max) zoom = Vector2(new_zoom, new_zoom) + global_position += previous_mouse_position - get_global_mouse_position() zoomed.emit(zoom) @@ -77,6 +81,7 @@ func _input(event): is_in_edge_mode = true edge += Vector2.DOWN edge = edge.normalized() + is_in_edge_mode = false if event is InputEventMouseButton and event.is_pressed(): Input.mouse_mode = Input.MOUSE_MODE_CONFINED |