pinching now work consistently.

This commit is contained in:
Bryce Covert
2017-05-31 20:17:48 -07:00
parent 8aa2f86122
commit 9825eba3ae
2 changed files with 9 additions and 10 deletions

View File

@@ -181,10 +181,6 @@
(do (screen! hud :on-return-item {})
entities)
(and (get-in entities [:cam :pinching])
(not (input! :is-touched)))
(update-in entities [:cam] dissoc :start-zoom :pinching)
(and (get-in entities [:state :active?])
(or (not (get-in entities [:state :hud-active?]))
(get-in entities [:fg-actions :script-running?]))
@@ -1369,15 +1365,18 @@
distance (.dst pointer-1 pointer-2)
[pointer-1-x pointer-1-y] (utils/unproject screen nil [(.x initial-pointer-1) (.y initial-pointer-1)])
[pointer-2-x pointer-2-y] (utils/unproject screen nil [(.x initial-pointer-2) (.y initial-pointer-2)])]
(as-> entities entities
(remove-cam-tweens entities)
(if (not start-zoom)
(assoc-in entities [:cam :start-zoom] zoom)
(-> entities
(assoc-in [:cam :start-zoom] zoom)
(assoc-in [:cam :ideal-x] (* 0.5 (+ pointer-1-x pointer-2-x)))
(assoc-in [:cam :ideal-y] (* 0.5 (+ pointer-1-y pointer-2-y))))
entities)
(assoc-in entities [:cursor :last-pos] [0 0])
(assoc-in entities [:cam :ideal-x] (* 0.5 (+ pointer-1-x pointer-2-x)))
(assoc-in entities [:cam :ideal-y] (* 0.5 (+ pointer-1-y pointer-2-y)))
(assoc-in entities [:cam :pinching] true)
(assoc-in entities [:cam :x] (utils/bound-to-camera (get-in entities [:cam :ideal-x]) 320 (get-in entities [:cam :zoom])) )
@@ -1443,10 +1442,11 @@
(assoc-in [:cursor :max-counter] 0))
options)
(= currently-pressed 0)
(<= currently-pressed 0)
(-> entities
(assoc-in [:cursor :counter] 0)
(assoc-in [:cursor :max-counter] 0))
(assoc-in [:cursor :max-counter] 0)
(update-in [:cam] dissoc :start-zoom :pinching))
(get-in entities [:state :active?])
(update-in entities [:cursor :counter] #(max 0 (dec %)))