hard to say why, but this makes mobile padding work again.
This commit is contained in:
@@ -151,6 +151,10 @@
|
|||||||
:bg p
|
:bg p
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
|
:on-pinch
|
||||||
|
(fn [screen entities {:keys [initial-pointer-1 initial-pointer-2]}]
|
||||||
|
(assoc-in entities [:state :pinching] true))
|
||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
|
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
|
||||||
(.apply viewport)
|
(.apply viewport)
|
||||||
@@ -168,15 +172,16 @@
|
|||||||
(fn [screen entities {:keys [choices callback]}]
|
(fn [screen entities {:keys [choices callback]}]
|
||||||
(let [choice-count (count choices)
|
(let [choice-count (count choices)
|
||||||
font (get-in entities [:state :font])
|
font (get-in entities [:state :font])
|
||||||
|
label-width (- 1280 (* utils/ui-scale 100))
|
||||||
labels (vec (->> (for [[[text] i] (map vector choices (range))]
|
labels (vec (->> (for [[[text] i] (map vector choices (range))]
|
||||||
(assoc
|
(assoc
|
||||||
(label text (style :label font (color 0.6 1.0 1.0 1.0)) :set-wrap true :set-alignment Align/bottomLeft
|
(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-font-scale (* utils/ui-scale 0.25)
|
||||||
:set-width 1240)
|
:set-width label-width)
|
||||||
|
|
||||||
:index i
|
:index i
|
||||||
:width 1240))
|
:width label-width))
|
||||||
(map (fn [l] (assoc (table [[ l :width 1240]])
|
(map (fn [l] (assoc (table [[ l :width label-width]])
|
||||||
:label l
|
:label l
|
||||||
:index (:index l))))))]
|
:index (:index l))))))]
|
||||||
(-> entities
|
(-> entities
|
||||||
@@ -195,16 +200,20 @@
|
|||||||
|
|
||||||
:on-touch-up (fn [screen entities options]
|
:on-touch-up (fn [screen entities options]
|
||||||
(let [[x y] (utils/unproject screen 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])))]
|
(when-let [choice (first (filter #(utils/intersects? % [x y]) (get-in entities [:state :labels])))]
|
||||||
(utils/clear-stage screen)
|
(utils/clear-stage screen)
|
||||||
((get-in entities [:state :callback]) (:index choice))
|
((get-in entities [:state :callback]) (:index choice))
|
||||||
(-> entities
|
(-> entities
|
||||||
(assoc-in [:state :callback] nil)
|
(assoc-in [:state :callback] nil)
|
||||||
|
(assoc-in [:state :pinching] false)
|
||||||
(assoc-in [:state :choices] [])
|
(assoc-in [:state :choices] [])
|
||||||
(assoc-in [:state :labels] [])
|
(assoc-in [:state :labels] [])
|
||||||
(assoc-in [:state :table] nil)
|
(assoc-in [:state :table] nil)
|
||||||
(select-keys [:state]))))))
|
(select-keys [:state])))
|
||||||
|
|
||||||
|
(assoc-in entities [:state :pinching] false))))
|
||||||
|
|
||||||
:on-mouse-moved mouse-moved
|
:on-mouse-moved mouse-moved
|
||||||
:on-touch-dragged mouse-moved
|
:on-touch-dragged mouse-moved
|
||||||
|
|||||||
@@ -161,6 +161,7 @@
|
|||||||
:show-screen (fn [screen entities {:keys [items]}]
|
:show-screen (fn [screen entities {:keys [items]}]
|
||||||
(log/info "showing inventory")
|
(log/info "showing inventory")
|
||||||
(when-not (:shown? entities)
|
(when-not (:shown? entities)
|
||||||
|
(label! (entities :hovered-text) :set-text "")
|
||||||
(-> entities
|
(-> entities
|
||||||
(assoc :shown? true
|
(assoc :shown? true
|
||||||
:opacity 0.0
|
:opacity 0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user