🐛 Fix problems with texts

This commit is contained in:
alonso.torres 2022-08-30 08:15:25 +02:00 committed by Alejandro Alonso
parent d034b61318
commit 282941d284
5 changed files with 30 additions and 30 deletions

View file

@ -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
[]

View file

@ -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 {}))