Improved selection rect calculation

This commit is contained in:
alonso.torres 2021-11-26 12:44:41 +01:00
parent 9d66984c62
commit 3bbcd235e1
5 changed files with 60 additions and 39 deletions

View file

@ -248,8 +248,12 @@
(cond-> modif-tree
(not (empty? (d/without-keys child-modifiers [:ignore-geometry?])))
(set-modifiers-new*
objects child child-modifiers root transformed-root ignore-constraints))))
(set-modifiers-recursive objects
child
child-modifiers
root
transformed-root
ignore-constraints))))
modif-tree
(-> modif-tree

View file

@ -153,7 +153,7 @@
(defn empty-map [keys]
(into {} (map #(hash-map % nil)) keys))
(defn get-attrs
(defn get-attrs*
"Given a `type` of options that we want to extract and the shapes to extract them from
returns a list of tuples [id, values] with the extracted properties for the shapes that
applies (some of them ignore some attributes)"
@ -182,11 +182,13 @@
(select-keys txt/default-text-attrs attrs)
(attrs/get-attrs-multi (txt/node-seq content) attrs))))]
:children (let [children (->> (:shapes shape []) (map #(get objects %)))
[new-ids new-values] (get-attrs children objects attr-type)]
[new-ids new-values] (get-attrs* children objects attr-type)]
[(into ids new-ids) (merge-attrs values new-values)])
[])))]
(reduce extract-attrs [[] []] shapes)))
(def get-attrs (memoize get-attrs*))
(mf/defc options
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes" "shapes-with-children"]))]
::mf/wrap-props false}