mirror of
https://github.com/penpot/penpot.git
synced 2025-06-08 18:11:38 +02:00
Fix bugs introduced in previous commit.
This commit is contained in:
parent
1924570ea1
commit
a64c18eff7
1 changed files with 5 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
||||||
[uxbox.util.data :refer (remove-nil-vals)]))
|
[uxbox.util.data :refer (remove-nil-vals)]))
|
||||||
|
|
||||||
(defn- transform-attr
|
(defn- transform-attr
|
||||||
[acc key value]
|
[data acc key value]
|
||||||
(case key
|
(case key
|
||||||
:view-box
|
:view-box
|
||||||
(assoc! acc key (apply str (interpose " " value)))
|
(assoc! acc key (apply str (interpose " " value)))
|
||||||
|
@ -15,8 +15,7 @@
|
||||||
(assoc! acc :preserveAspectRatio (if value "xMidYMid" "none"))
|
(assoc! acc :preserveAspectRatio (if value "xMidYMid" "none"))
|
||||||
|
|
||||||
:rotation
|
:rotation
|
||||||
(let [width (nth (:view-box data) 3)
|
(let [center-x (+ (:x data) (/ (:width data) 2))
|
||||||
center-x (+ (:x data) (/ (:width data) 2))
|
|
||||||
center-y (+ (:y data) (/ (:height data) 2))]
|
center-y (+ (:y data) (/ (:height data) 2))]
|
||||||
(assoc! acc :transform (str/format "rotate(%s %s %s)"
|
(assoc! acc :transform (str/format "rotate(%s %s %s)"
|
||||||
value center-x center-y)))
|
value center-x center-y)))
|
||||||
|
@ -26,7 +25,9 @@
|
||||||
(defn- transform-attrs
|
(defn- transform-attrs
|
||||||
[data]
|
[data]
|
||||||
(persistent!
|
(persistent!
|
||||||
(reduce-kv transform-attr (transient {}) data)))
|
(reduce-kv (partial transform-attr data)
|
||||||
|
(transient {})
|
||||||
|
data)))
|
||||||
|
|
||||||
(defn- extract-attrs
|
(defn- extract-attrs
|
||||||
"Extract predefinet attrs from shapes."
|
"Extract predefinet attrs from shapes."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue