panning cancels click

This commit is contained in:
Bryce Covert
2016-12-05 09:37:14 -08:00
parent 3370756f1c
commit d7bc926607
2 changed files with 21 additions and 8 deletions

View File

@@ -286,20 +286,23 @@
:on-hover-start
(fn [screen {:keys [all-icons] :as entities} {:keys [hover-text x y scene-viewport cursor ]}]
(println cursor hover-text)
(let [x (if utils/mobile? x (+ 8 x))
[scene-x scene-y] (scene-world->talk-world scene-viewport [x y])
depressed? (< 0.5 (- (or (:total-time screen) 0) (int (or (:total-time screen) 0))))]
depressed? (< 0.5 (- (or (:total-time screen) 0) (int (or (:total-time screen) 0))))
item-cursor (:cursor (first (:last cursor)))
action-cursor (utils/translate-depressed (first (:last cursor)) depressed?)]
(label! (get-in entities [:label]) :set-text hover-text)
(cond-> entities
true (assoc-in [:label :text] hover-text)
utils/mobile? (update-in [:label] assoc :x (* 20 4) :y 12)
(and utils/mobile? (or (:cursor (first (:last cursor))) (first (:last cursor))))
(and utils/mobile? (or item-cursor action-cursor)
#_(not= :main action-cursor))
(assoc-in [:action-icon]
(assoc
(texture (aget all-icons 0 (.indexOf utils/+all-cursors+ (or (:cursor (first (:last cursor))) (utils/translate-depressed (first (:last cursor))
depressed?)))))
(texture (aget all-icons 0 (.indexOf utils/+all-cursors+ (or item-cursor action-cursor))))
:x 4 :y 4
:width (* 18 4) :height (* 16 4)))