1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Implement #540 and a part of #429 for the zoom tool

This commit is contained in:
Manolis Papadeas 2021-11-03 02:23:26 +02:00
parent 11f8402d57
commit 77996c769e

View file

@ -1,9 +1,25 @@
extends BaseTool
var _relative : Vector2
var _prev_zoom_mode := 0
var _zoom_mode := 0
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
_relative = event.relative
if event.is_action_pressed("ctrl"):
_prev_zoom_mode = $ModeOptions.selected
if event.is_action("ctrl"):
$ModeOptions.selected = _prev_zoom_mode ^ 1
_zoom_mode = $ModeOptions.selected
if event.is_action_released("ctrl"):
$ModeOptions.selected = _prev_zoom_mode
_zoom_mode = $ModeOptions.selected
func _on_ModeOptions_item_selected(id : int) -> void:
_zoom_mode = id
update_config()
@ -44,7 +60,7 @@ func draw_start(_position : Vector2) -> void:
func draw_move(_position : Vector2) -> void:
pass
Global.camera.zoom_camera(-_relative.x / 3)
func draw_end(_position : Vector2) -> void: