fixed checks for if post it is attached or if card has post it attached
This commit is contained in:
parent
d99b9edfdf
commit
5c487f55df
|
|
@ -52,6 +52,7 @@ var scale_tween
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
@export var is_dragable: bool = false
|
@export var is_dragable: bool = false
|
||||||
@onready var diameter = $CollisionShape2D.shape.height
|
@onready var diameter = $CollisionShape2D.shape.height
|
||||||
|
@onready var postit_anchor = get_child(3)
|
||||||
|
|
||||||
var is_dragged: bool = false:
|
var is_dragged: bool = false:
|
||||||
set(dragged):
|
set(dragged):
|
||||||
|
|
@ -124,7 +125,7 @@ func _on_mouse_entered():
|
||||||
is_mouse_entered = true
|
is_mouse_entered = true
|
||||||
if not Input.is_action_pressed("mouse_left"):
|
if not Input.is_action_pressed("mouse_left"):
|
||||||
if has_postit_attached():
|
if has_postit_attached():
|
||||||
if get_child(-1).highlighted:
|
if postit_anchor.get_child(-1).highlighted:
|
||||||
return
|
return
|
||||||
highlighted = true
|
highlighted = true
|
||||||
if "handle_hover" in owner:
|
if "handle_hover" in owner:
|
||||||
|
|
@ -151,11 +152,7 @@ func _move_card():
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func has_postit_attached() -> bool:
|
func has_postit_attached() -> bool:
|
||||||
var all_children = get_children()
|
return postit_anchor.get_child(-1) is PostIt
|
||||||
for child in all_children:
|
|
||||||
if child is PostIt:
|
|
||||||
return true
|
|
||||||
return false
|
|
||||||
|
|
||||||
func check_hover():
|
func check_hover():
|
||||||
if is_mouse_entered:
|
if is_mouse_entered:
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,8 @@ func _move_post_it():
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func is_postit_attached() -> bool:
|
func is_postit_attached() -> bool:
|
||||||
if self.get_parent() is Card:
|
# there is probably a nicer way to do this
|
||||||
return true
|
return self.get_parent().get_parent() is Card
|
||||||
return false
|
|
||||||
|
|
||||||
func tween_transform_to(target: Vector2):
|
func tween_transform_to(target: Vector2):
|
||||||
var transform_tween = create_tween()
|
var transform_tween = create_tween()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue