extends Camera2D var dragging = false @export var max_zoom = 2 @export var min_zoom = 0.1 func _input(event: InputEvent) -> void: if event.is_action("drag_camera"): if event.is_released(): dragging = false else: dragging = true elif event.is_action("zoom_out"): zoom *= 0.9 if zoom.x < min_zoom: zoom = Vector2(min_zoom,min_zoom) elif event.is_action("zoom_in"): zoom *= 1.1 if zoom.x > max_zoom: zoom = Vector2(max_zoom,max_zoom) elif event is InputEventMouse: if event is InputEventMouseMotion: if dragging: position -= event.relative / zoom.x