Skip to content

Commit

Permalink
Hint if a block will be deleted when it is dragged
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanmccall committed Jun 25, 2024
1 parent 3a8630a commit a6f9366
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion addons/block_code/drag_manager/drag_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Drag:
get:
return action
set(value):
action = value
if action != value:
action = value
_update_action_hint()

var target_snap_point: SnapPoint:
get:
Expand Down Expand Up @@ -122,6 +124,13 @@ class Drag:
var from_global: Vector2 = _block.global_position
return from_global.distance_to(snap_point.global_position)

func _update_action_hint():
match action:
DragAction.REMOVE:
_block.modulate = Color(1.0, 1.0, 1.0, 0.5)
_:
_block.modulate = Color.WHITE

func _update_preview():
if _preview_block:
_preview_block.queue_free()
Expand Down

0 comments on commit a6f9366

Please sign in to comment.