From 1f2ca1e1a799f6657bd0b17b570004013c4383f3 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 17 Apr 2024 21:34:21 +0200 Subject: [PATCH] improve dot touch --- app/content/system/dot/dot.gd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/content/system/dot/dot.gd b/app/content/system/dot/dot.gd index 89e175b..faded69 100644 --- a/app/content/system/dot/dot.gd +++ b/app/content/system/dot/dot.gd @@ -12,6 +12,7 @@ var active = R.state(false) var disabled = R.state(true) var touched_enter = 0.0 var moved_ran = false +var touch_ran = false var miniature = House.body.mini_view @@ -48,9 +49,19 @@ func _on_press_up(_event: EventPointer): func _on_touch_enter(_event: EventTouch): touched_enter = Time.get_ticks_msec() + touch_ran = false + +func _on_touch_move(_event: EventTouch): + if touch_ran||Time.get_ticks_msec() - touched_enter < TOUCH_LONG: return + + miniature.entity_select.toggle(entity) + + touch_ran = true func _on_touch_leave(_event: EventTouch): - if Time.get_ticks_msec() - touched_enter < TOUCH_LONG&&entity.has_method("quick_action"): + if touch_ran: return + + if entity.has_method("quick_action"): entity.quick_action() else: miniature.entity_select.toggle(entity) \ No newline at end of file