From 15a1d2a66e48324e1d560dc13b776627820f3999 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 27 Oct 2024 15:52:48 +0100 Subject: next commit --- UI/Camera.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'UI/Camera.gd') 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 -- cgit v1.2.3