mirror of
https://github.com/penpot/penpot.git
synced 2025-02-24 15:56:11 -05:00
🐛 Fix problem with exporter texts
This commit is contained in:
parent
857429290d
commit
a8363f0c02
3 changed files with 28 additions and 5 deletions
|
@ -122,7 +122,11 @@
|
||||||
(add! :stroke-cap-end)))
|
(add! :stroke-cap-end)))
|
||||||
|
|
||||||
(cond-> text?
|
(cond-> text?
|
||||||
(-> (add! :grow-type)
|
(-> (add! :x)
|
||||||
|
(add! :y)
|
||||||
|
(add! :width)
|
||||||
|
(add! :height)
|
||||||
|
(add! :grow-type)
|
||||||
(add! :content (comp json/encode uuid->string))
|
(add! :content (comp json/encode uuid->string))
|
||||||
(add! :position-data (comp json/encode uuid->string))))
|
(add! :position-data (comp json/encode uuid->string))))
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,13 @@
|
||||||
(obj/unset! "disable-shadows?")
|
(obj/unset! "disable-shadows?")
|
||||||
(obj/set! "ref" ref)
|
(obj/set! "ref" ref)
|
||||||
(obj/set! "id" (dm/fmt "shape-%" shape-id))
|
(obj/set! "id" (dm/fmt "shape-%" shape-id))
|
||||||
|
|
||||||
|
;; TODO: This is added for backward compatibility.
|
||||||
|
(cond-> (and (cfh/text-shape? shape) (empty? (:position-data shape)))
|
||||||
|
(-> (obj/set! "x" (:x shape))
|
||||||
|
(obj/set! "y" (:y shape))
|
||||||
|
(obj/set! "width" (:width shape))
|
||||||
|
(obj/set! "height" (:height shape))))
|
||||||
(obj/set! "style" styles))
|
(obj/set! "style" styles))
|
||||||
|
|
||||||
wrapper-props
|
wrapper-props
|
||||||
|
|
|
@ -272,9 +272,21 @@
|
||||||
(def has-position? #{:frame :rect :image :text})
|
(def has-position? #{:frame :rect :image :text})
|
||||||
|
|
||||||
(defn parse-position
|
(defn parse-position
|
||||||
[props svg-data]
|
[props node svg-data]
|
||||||
(let [values (->> (select-keys svg-data [:x :y :width :height])
|
(let [x (get-meta node :x d/parse-double)
|
||||||
(d/mapm (fn [_ val] (d/parse-double val))))]
|
y (get-meta node :y d/parse-double)
|
||||||
|
width (get-meta node :width d/parse-double)
|
||||||
|
height (get-meta node :height d/parse-double)
|
||||||
|
|
||||||
|
values (->> (select-keys svg-data [:x :y :width :height])
|
||||||
|
(d/mapm (fn [_ val] (d/parse-double val))))
|
||||||
|
|
||||||
|
values
|
||||||
|
(cond-> values
|
||||||
|
(some? x) (assoc :x x)
|
||||||
|
(some? y) (assoc :y y)
|
||||||
|
(some? width) (assoc :width width)
|
||||||
|
(some? height) (assoc :height height))]
|
||||||
(d/merge props values)))
|
(d/merge props values)))
|
||||||
|
|
||||||
(defn parse-circle
|
(defn parse-circle
|
||||||
|
@ -392,7 +404,7 @@
|
||||||
center (gpt/point center-x center-y)]
|
center (gpt/point center-x center-y)]
|
||||||
(cond-> props
|
(cond-> props
|
||||||
(has-position? type)
|
(has-position? type)
|
||||||
(parse-position svg-data)
|
(parse-position node svg-data)
|
||||||
|
|
||||||
(= type :svg-raw)
|
(= type :svg-raw)
|
||||||
(add-svg-position node)
|
(add-svg-position node)
|
||||||
|
|
Loading…
Add table
Reference in a new issue