diff options
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 |