From d6b3fd805c4b432d381d9784bb4ea8183c09bea1 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 26 Dec 2016 16:49:23 -0800 Subject: [PATCH] hard to say why, but this makes mobile padding work again. --- .../src-common/advent/screens/dialogue.clj | 19 ++++++++++++++----- .../src-common/advent/screens/inventory.clj | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/desktop/src-common/advent/screens/dialogue.clj b/desktop/src-common/advent/screens/dialogue.clj index 9d576ec7..d0ddbf75 100644 --- a/desktop/src-common/advent/screens/dialogue.clj +++ b/desktop/src-common/advent/screens/dialogue.clj @@ -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 diff --git a/desktop/src-common/advent/screens/inventory.clj b/desktop/src-common/advent/screens/inventory.clj index 96e5f149..c42b8b3e 100644 --- a/desktop/src-common/advent/screens/inventory.clj +++ b/desktop/src-common/advent/screens/inventory.clj @@ -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