mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 18:51:29 -05:00
Initial work on fontSize rendering on text shapes.
This commit is contained in:
parent
016b43e1a5
commit
abed5dd35d
1 changed files with 11 additions and 2 deletions
|
@ -132,6 +132,13 @@
|
|||
:style {:stroke "#333" :fill "transparent"
|
||||
:stroke-opacity "0.4"}})
|
||||
|
||||
(def ^:const +style-attrs+
|
||||
[:font-size])
|
||||
|
||||
(defn- build-style
|
||||
[{:keys [font-size]}]
|
||||
(merge {} (when font-size {:fontSize (str font-size "px")})))
|
||||
|
||||
(defmethod uusc/render-shape :builtin/text
|
||||
[{:keys [id x1 y1 x2 y2 content drawing? editing?] :as shape}]
|
||||
(let [key (str id)
|
||||
|
@ -139,12 +146,14 @@
|
|||
size (ush/size shape)
|
||||
props {:x x1 :y y1
|
||||
:transform (str rfm)}
|
||||
attrs (merge props size)]
|
||||
attrs (merge props size)
|
||||
style (build-style shape)]
|
||||
|
||||
(html
|
||||
[:g
|
||||
(if (or drawing? editing?)
|
||||
[:g
|
||||
[:rect (merge attrs +select-rect-attrs+)]])
|
||||
[:foreignObject attrs
|
||||
[:p {:ref "container"} content]]])))
|
||||
[:p {:ref "container" :style style} content]]])))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue