mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 01:16:10 +02:00
✨ Import masks
This commit is contained in:
parent
152bcf451a
commit
cc2c249a07
2 changed files with 18 additions and 2 deletions
|
@ -28,7 +28,10 @@
|
||||||
(-> props
|
(-> props
|
||||||
(obj/set! ns-attr val))))
|
(obj/set! ns-attr val))))
|
||||||
frame? (= :frame (:type shape))
|
frame? (= :frame (:type shape))
|
||||||
text? (= :text (:type shape))]
|
group? (= :group (:type shape))
|
||||||
|
rect? (= :text (:type shape))
|
||||||
|
text? (= :text (:type shape))
|
||||||
|
mask? (and group? (:masked-group? shape))]
|
||||||
(-> props
|
(-> props
|
||||||
(add! :name (-> shape :name))
|
(add! :name (-> shape :name))
|
||||||
(add! :blocked (-> shape (:blocked false) str))
|
(add! :blocked (-> shape (:blocked false) str))
|
||||||
|
@ -41,7 +44,7 @@
|
||||||
(add! :transform (-> shape (:transform (gmt/matrix)) str))
|
(add! :transform (-> shape (:transform (gmt/matrix)) str))
|
||||||
(add! :transform-inverse (-> shape (:transform-inverse (gmt/matrix)) str))
|
(add! :transform-inverse (-> shape (:transform-inverse (gmt/matrix)) str))
|
||||||
|
|
||||||
(cond-> (some? (:r1 shape))
|
(cond-> (and rect? (some? (:r1 shape)))
|
||||||
(-> (add! :r1 (-> shape (:r1 0) str))
|
(-> (add! :r1 (-> shape (:r1 0) str))
|
||||||
(add! :r2 (-> shape (:r2 0) str))
|
(add! :r2 (-> shape (:r2 0) str))
|
||||||
(add! :r3 (-> shape (:r3 0) str))
|
(add! :r3 (-> shape (:r3 0) str))
|
||||||
|
@ -51,6 +54,9 @@
|
||||||
(-> (add! :grow-type (-> shape :grow-type))
|
(-> (add! :grow-type (-> shape :grow-type))
|
||||||
(add! :content (-> shape :content json/encode))))
|
(add! :content (-> shape :content json/encode))))
|
||||||
|
|
||||||
|
(cond-> mask?
|
||||||
|
(add! :masked-group "true"))
|
||||||
|
|
||||||
(cond-> frame?
|
(cond-> frame?
|
||||||
(obj/set! "xmlns:penpot" "https://penpot.app/xmlns")))))
|
(obj/set! "xmlns:penpot" "https://penpot.app/xmlns")))))
|
||||||
|
|
||||||
|
|
|
@ -238,6 +238,13 @@
|
||||||
[val]
|
[val]
|
||||||
(= val "true"))
|
(= val "true"))
|
||||||
|
|
||||||
|
(defn add-group-data
|
||||||
|
[props node]
|
||||||
|
(let [mask? (get-meta node :masked-group str->bool)]
|
||||||
|
(cond-> props
|
||||||
|
mask?
|
||||||
|
(assoc :masked-group? true))))
|
||||||
|
|
||||||
(defn parse-data
|
(defn parse-data
|
||||||
[type node]
|
[type node]
|
||||||
|
|
||||||
|
@ -257,6 +264,9 @@
|
||||||
(assoc :blocked blocked)
|
(assoc :blocked blocked)
|
||||||
(assoc :hidden hidden)
|
(assoc :hidden hidden)
|
||||||
|
|
||||||
|
(cond-> (= :group type)
|
||||||
|
(add-group-data node))
|
||||||
|
|
||||||
(cond-> (= :image type)
|
(cond-> (= :image type)
|
||||||
(add-image-data node data))
|
(add-image-data node data))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue