hard to say why, but this makes mobile padding work again.

This commit is contained in:
Bryce Covert
2016-12-26 16:49:23 -08:00
parent b7690a97c0
commit d6b3fd805c
2 changed files with 15 additions and 5 deletions

View File

@@ -151,6 +151,10 @@
:bg p
}}))
:on-pinch
(fn [screen entities {:keys [initial-pointer-1 initial-pointer-2]}]
(assoc-in entities [:state :pinching] true))
:on-render
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
(.apply viewport)
@@ -168,15 +172,16 @@
(fn [screen entities {:keys [choices callback]}]
(let [choice-count (count choices)
font (get-in entities [:state :font])
label-width (- 1280 (* utils/ui-scale 100))
labels (vec (->> (for [[[text] i] (map vector choices (range))]
(assoc
(label text (style :label font (color 0.6 1.0 1.0 1.0)) :set-wrap true :set-alignment Align/bottomLeft
:set-font-scale (* utils/ui-scale 0.25)
:set-width 1240)
:set-width label-width)
:index i
:width 1240))
(map (fn [l] (assoc (table [[ l :width 1240]])
:width label-width))
(map (fn [l] (assoc (table [[ l :width label-width]])
:label l
:index (:index l))))))]
(-> entities
@@ -195,16 +200,20 @@
:on-touch-up (fn [screen entities options]
(let [[x y] (utils/unproject screen options)]
(when (seq (get-in entities [:state :choices]))
(if (and (seq (get-in entities [:state :choices]))
(not (get-in entities [:state :pinching])))
(when-let [choice (first (filter #(utils/intersects? % [x y]) (get-in entities [:state :labels])))]
(utils/clear-stage screen)
((get-in entities [:state :callback]) (:index choice))
(-> entities
(assoc-in [:state :callback] nil)
(assoc-in [:state :pinching] false)
(assoc-in [:state :choices] [])
(assoc-in [:state :labels] [])
(assoc-in [:state :table] nil)
(select-keys [:state]))))))
(select-keys [:state])))
(assoc-in entities [:state :pinching] false))))
:on-mouse-moved mouse-moved
:on-touch-dragged mouse-moved

View File

@@ -161,6 +161,7 @@
:show-screen (fn [screen entities {:keys [items]}]
(log/info "showing inventory")
(when-not (:shown? entities)
(label! (entities :hovered-text) :set-text "")
(-> entities
(assoc :shown? true
:opacity 0.0