Handling group inheritance

This commit is contained in:
alonso.torres 2021-02-25 09:41:57 +01:00 committed by Andrey Antukh
parent 94c5004c33
commit 59022904fb
6 changed files with 48 additions and 45 deletions

View file

@ -78,7 +78,8 @@
(defn ^:export dump-object [name]
(let [page-id (get @state :current-page-id)]
(let [objects (get-in @state [:workspace-data :pages-index page-id :objects])
target (d/seek (fn [[id shape]] (= name (:name shape))) objects)]
target (or (d/seek (fn [[id shape]] (= name (:name shape))) objects)
(get objects (uuid name)))]
(->> target
(logjs "state")))))

View file

@ -116,7 +116,6 @@
(obj/merge! attrs (clj->js stroke-attrs)))
attrs)))
(defn extract-svg-attrs
[render-id svg-defs svg-attrs]
(let [replace-id (fn [id]
@ -124,8 +123,9 @@
(str render-id "-" id)
id))
svg-attrs (-> svg-attrs
(usvg/clean-attrs)
(usvg/update-attr-ids replace-id)
(usvg/clean-attrs))
)
attrs (-> svg-attrs (dissoc :style) (clj->js))
styles (-> svg-attrs (:style {}) (clj->js))]

View file

@ -84,16 +84,18 @@
(mf/defc svg-defs [{:keys [shape render-id]}]
(let [svg-defs (:svg-defs shape)
_ (when (:svg-transform shape) (.log js/console (str (:svg-transform shape))))
;;_ (when (:svg-transform shape)
;; (.log js/console (:name shape) (:old-transform shape) (str (:svg-transform shape))))
transform (mf/use-memo
(mf/deps shape)
#(if (= :svg-raw (:type shape))
(gmt/matrix)
(usvg/svg-transform-matrix shape)))
;;transform (gmt/multiply
;; transform
;; (:svg-transform shape (gmt/matrix)))
transform (gmt/multiply
transform
(or (:svg-transform shape) (gmt/matrix)))
prefix-id
(fn [id]