🐛 Fix selection handlers reactivity.

This commit is contained in:
Andrey Antukh 2019-08-22 20:18:35 +02:00
parent 5a820b4f9e
commit f0230c346c
3 changed files with 23 additions and 44 deletions

View file

@ -565,7 +565,6 @@
;; --- Outer Rect
(declare selection-rect-generic)
(declare selection-rect-group)
(defn rotation-matrix
"Generate a rotation matrix from shape."
@ -590,25 +589,15 @@
([shape]
(selection-rect @st/state shape))
([state shape]
(let [{:keys [displacement resize]} (:modifiers shape)]
(let [modifier (:modifier-mtx shape)]
(-> (shape->rect-shape shape)
(assoc :type :rect :id (:id shape))
(transform (or resize (gmt/matrix)))
(transform (or displacement (gmt/matrix)))
(transform (or modifier (gmt/matrix)))
(rotate-shape)
(size)))))
;; --- Helpers
(defn resolve-parent
"Recursively resolve the real shape parent."
([shape]
(resolve-parent @st/state shape))
([state {:keys [group] :as shape}]
(if group
(resolve-parent state (get-in state [:shapes group]))
shape)))
(defn contained-in?
"Check if a shape is contained in the
provided selection rect."