improved area movement
This commit is contained in:
parent
45fb225e54
commit
72825ecae6
|
|
@ -76,6 +76,8 @@ func _process(delta: float) -> void:
|
|||
|
||||
if highlighted:
|
||||
_handle_wiggle(delta)
|
||||
|
||||
_move_card()
|
||||
|
||||
func _handle_wiggle(delta):
|
||||
wiggle_pos += delta * wiggle_speed * wiggle_intensity
|
||||
|
|
@ -105,11 +107,14 @@ func _on_mouse_exited():
|
|||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
|
||||
if event is InputEventMouseMotion and is_dragged:
|
||||
position += event.relative
|
||||
if event is InputEventMouseMotion:
|
||||
_move_card()
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if is_dragable and "handle_mouse_button" in owner:
|
||||
owner.handle_mouse_button(self, event)
|
||||
|
||||
func _move_card():
|
||||
if is_dragged:
|
||||
position += get_viewport().get_mouse_position() - position
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ func replace_with(postit: PostIt):
|
|||
self.sibling = postit.sibling
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
_move_post_it()
|
||||
|
||||
|
||||
func _on_focus_entered():
|
||||
print(self, "is focused")
|
||||
|
|
@ -80,11 +81,15 @@ func _on_mouse_exited():
|
|||
highlighted = false
|
||||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseMotion and is_dragged:
|
||||
position += event.relative
|
||||
if event is InputEventMouseMotion:
|
||||
_move_post_it()
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if is_dragable and "handle_mouse_button" in owner:
|
||||
owner.handle_mouse_button(self, event)
|
||||
|
||||
func _move_post_it():
|
||||
if is_dragged:
|
||||
position += get_viewport().get_mouse_position() - position
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue