trying to fix issue where item stays selected.

This commit is contained in:
Bryce Covert
2017-06-21 12:27:53 -07:00
parent d74604b578
commit 0ac95fb8f9

View File

@@ -31,10 +31,11 @@
:finish #(assoc % :shown? false))))) :finish #(assoc % :shown? false)))))
(defn mouse-down [screen entities options] (defn mouse-down [screen entities options]
(let [[x y] (utils/unproject screen options) (when (interactable? entities)
selected-entity (first (filter #((:box %) x y) (vals (:items entities))))] (let [[x y] (utils/unproject screen options)
(assoc entities :selected-item (:item selected-entity) selected-entity (first (filter #((:box %) x y) (vals (:items entities))))]
:down-time (:total-time screen)))) (assoc entities :selected-item (:item selected-entity)
:down-time (:total-time screen)))))
(defn mouse-outside-inventory? [[x y]] (defn mouse-outside-inventory? [[x y]]
(or (< x 140) (or (< x 140)