🐛 Fix SVG texts positioning inconsistencies

This commit is contained in:
alonso.torres 2022-07-13 11:02:33 +02:00 committed by Andrey Antukh
parent 46c9fc1c5f
commit 06905d5fa6
2 changed files with 3 additions and 8 deletions

View file

@ -11,7 +11,6 @@
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh]
[app.config :as cfg]
[app.main.ui.context :as muc]
[app.main.ui.shapes.attrs :as attrs]
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
@ -87,18 +86,13 @@
[:> :g group-props
(for [[index data] (d/enumerate position-data)]
(let [y (if (cfg/check-browser? :safari)
(- (:y data) (:height data))
(:y data))
alignment-bl (when (cfg/check-browser? :safari) "text-before-edge")
dominant-bl (when-not (cfg/check-browser? :safari) "ideographic")
(let [y (- (:y data) (:height data))
dominant-bl "text-before-edge"
rtl? (= "rtl" (:direction data))
props (-> #js {:key (dm/str "text-" (:id shape) "-" index)
:x (if rtl? (+ (:x data) (:width data)) (:x data))
:y y
:transform (position-data-transform shape data)
:alignmentBaseline alignment-bl
:dominantBaseline dominant-bl
:style (-> #js {:fontFamily (:font-family data)
:fontSize (:font-size data)