mirror of
https://github.com/penpot/penpot.git
synced 2025-07-22 21:47:15 +02:00
🐛 Fix problems with texts
This commit is contained in:
parent
d034b61318
commit
282941d284
5 changed files with 30 additions and 30 deletions
|
@ -332,10 +332,10 @@
|
|||
(defn bounding-rect->rect
|
||||
[rect]
|
||||
(when (some? rect)
|
||||
{:x (or (.-left rect) (:left rect))
|
||||
:y (or (.-top rect) (:top rect))
|
||||
:width (or (.-width rect) (:width rect))
|
||||
:height (or (.-height rect) (:height rect))}))
|
||||
{:x (or (.-left rect) (:left rect) 0)
|
||||
:y (or (.-top rect) (:top rect) 0)
|
||||
:width (or (.-width rect) (:width rect) 1)
|
||||
:height (or (.-height rect) (:height rect) 1)}))
|
||||
|
||||
(defn get-window-size
|
||||
[]
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
[parent-node direction text-node]
|
||||
|
||||
(letfn [(parse-entry [^js entry]
|
||||
{:node (.-node entry)
|
||||
:position (dom/bounding-rect->rect (.-position entry))
|
||||
:text (.-text entry)
|
||||
:direction direction})]
|
||||
(when (some? (.-position entry))
|
||||
{:node (.-node entry)
|
||||
:position (dom/bounding-rect->rect (.-position entry))
|
||||
:text (.-text entry)
|
||||
:direction direction}))]
|
||||
(into
|
||||
[]
|
||||
(map parse-entry)
|
||||
(keep parse-entry)
|
||||
(tpd/parse-text-nodes parent-node text-node))))
|
||||
|
||||
(def load-promises (atom {}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue