mirror of
https://github.com/penpot/penpot.git
synced 2025-03-28 15:41:25 -05:00
🐛 Fix edge case on parsing svg viewbox
This commit is contained in:
parent
75576c341d
commit
317f83e3ec
1 changed files with 7 additions and 5 deletions
|
@ -57,13 +57,15 @@
|
|||
clean-value))
|
||||
|
||||
(defn- svg-dimensions
|
||||
[data]
|
||||
(let [width (dm/get-in data [:attrs :width] 100)
|
||||
height (dm/get-in data [:attrs :height] 100)
|
||||
viewbox (or (dm/get-in data [:attrs :viewBox])
|
||||
[{:keys [attrs] :as data}]
|
||||
(let [width (:width attrs 100)
|
||||
height (:height attrs 100)
|
||||
viewbox (or (:viewBox attrs)
|
||||
(dm/str "0 0 " width " " height))
|
||||
[x y width height] (->> (str/split viewbox #"\s+")
|
||||
|
||||
[x y width height] (->> (str/split viewbox #"[\s,]+")
|
||||
(map d/parse-double))
|
||||
|
||||
width (if (= width 0) 1 width)
|
||||
height (if (= height 0) 1 height)]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue