Skip to content

Commit

Permalink
Rename symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacrain committed Sep 20, 2024
1 parent 062381c commit 02d3c1f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions lorien/InfiniteCanvas/InfiniteCanvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func _ready() -> void:

for child in $SubViewport.get_children():
if child is BaseCursor:
_camera.zoom_changed.connect(Callable(child, "_on_zoom_changed"))
_camera.position_changed.connect(Callable(child, "_on_canvas_position_changed"))
_camera.zoom_changed.connect(child._on_zoom_changed)
_camera.position_changed.connect(child._on_canvas_position_changed)

for child in get_children():
if child is CanvasTool:
_camera.is_panning.connect(Callable(child, "_on_is_panning"))
_camera.is_zooming.connect(Callable(child, "_on_is_zooming"))
_camera.panning_toggled.connect(child._on_panning_toggled)
_camera.zooming_toggled.connect(child._on_zooming_toggled)

_camera.zoom_changed.connect(_on_zoom_changed)
_camera.position_changed.connect(_on_camera_moved)
Expand Down
16 changes: 8 additions & 8 deletions lorien/InfiniteCanvas/PanZoomCamera.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extends Camera2D

# -------------------------------------------------------------------------------------------------
signal is_zooming(value: bool)
signal zooming_toggled(value: bool)
signal zoom_changed(value: float)
signal is_panning(value: bool)
signal panning_toggled(value: bool)
signal position_changed(value: Vector2)

# -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -41,10 +41,10 @@ func tool_event(event: InputEvent) -> void:
if event is InputEventKey:
if Utils.is_action_pressed("canvas_pan_key", event):
_pan_active = true
is_panning.emit(true)
panning_toggled.emit(true)
if Utils.is_action_released("canvas_pan_key", event):
_pan_active = false
is_panning.emit(false)
panning_toggled.emit(false)
if event is InputEventMouseButton:

# Scroll wheel up/down to zoom
Expand All @@ -59,14 +59,14 @@ func tool_event(event: InputEvent) -> void:
if event.button_index == MOUSE_BUTTON_MIDDLE:
if !event.ctrl_pressed:
_pan_active = event.is_pressed()
is_panning.emit(_pan_active)
panning_toggled.emit(_pan_active)
_zoom_active = false
is_zooming.emit(false)
zooming_toggled.emit(false)
else:
_zoom_active = event.is_pressed()
is_zooming.emit(_zoom_active)
zooming_toggled.emit(_zoom_active)
_pan_active = false
is_panning.emit(false)
panning_toggled.emit(false)
_start_mouse_pos = get_local_mouse_position()

elif event is InputEventMouseMotion:
Expand Down
14 changes: 7 additions & 7 deletions lorien/InfiniteCanvas/Tools/CanvasTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ func _on_brush_size_changed(size: int) -> void:
_cursor.change_size(size)

# -------------------------------------------------------------------------------------------------
func _on_is_panning(is_panning: bool) -> void:
panning_detected = is_panning
eval_disable_stroke()
func _on_panning_toggled(panning_enabled: bool) -> void:
panning_detected = panning_enabled
_eval_disable_stroke()

# -------------------------------------------------------------------------------------------------
func _on_is_zooming(is_zooming: bool) -> void:
zooming_detected = is_zooming
eval_disable_stroke()
func _on_zooming_toggled(zooming_enabled: bool) -> void:
zooming_detected = zooming_enabled
_eval_disable_stroke()

# -------------------------------------------------------------------------------------------------
func get_cursor() -> BaseCursor:
Expand Down Expand Up @@ -102,7 +102,7 @@ func end_stroke() -> void:
_canvas.end_stroke()
performing_stroke = false

func eval_disable_stroke() -> void:
func _eval_disable_stroke() -> void:
disable_stroke = panning_detected || zooming_detected

# TODO(gd4): probably don't need this anymore
Expand Down

0 comments on commit 02d3c1f

Please sign in to comment.