adding state handling to post_its
This commit is contained in:
parent
930538519f
commit
7fb7be47a8
|
|
@ -6,6 +6,8 @@ var sibling
|
|||
var shift_tween
|
||||
var modulate_tween
|
||||
|
||||
var on_stage = false
|
||||
|
||||
@export var text: String = "" :
|
||||
set (value):
|
||||
if is_inside_tree() or Engine.is_editor_hint():
|
||||
|
|
@ -60,9 +62,9 @@ func replace_with(postit: PostIt):
|
|||
self.sibling = postit.sibling
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if on_stage:
|
||||
_move_post_it()
|
||||
|
||||
|
||||
func _on_focus_entered():
|
||||
print(self, "is focused")
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ func _on_focus_exited():
|
|||
print(self, "is not focused")
|
||||
|
||||
func _on_mouse_entered():
|
||||
if not Input.is_action_pressed("mouse_left"):
|
||||
if on_stage and not Input.is_action_pressed("mouse_left"):
|
||||
highlighted = true
|
||||
if "handle_hover" in owner:
|
||||
owner.handle_hover(self)
|
||||
|
|
@ -79,6 +81,7 @@ func _on_mouse_exited():
|
|||
highlighted = false
|
||||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
if on_stage:
|
||||
if event is InputEventMouseMotion:
|
||||
_move_post_it()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue