mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 22:49:01 -05:00
🐛 Fix render of some texts without position data
This commit is contained in:
parent
de05521b57
commit
df255b5a6f
1 changed files with 16 additions and 15 deletions
|
@ -64,24 +64,25 @@
|
||||||
[{:keys [grow-type id migrate] :as shape} node]
|
[{:keys [grow-type id migrate] :as shape} node]
|
||||||
;; Check if we need to update the size because it's auto-width or auto-height
|
;; Check if we need to update the size because it's auto-width or auto-height
|
||||||
;; Update the position-data of every text fragment
|
;; Update the position-data of every text fragment
|
||||||
(p/let [position-data (tsp/calc-position-data id)]
|
(->> (tsp/calc-position-data id)
|
||||||
;; At least one paragraph needs to be inside the bounding box
|
(p/fmap (fn [position-data]
|
||||||
(when (gsht/overlaps-position-data? shape position-data)
|
;; At least one paragraph needs to be inside the bounding box
|
||||||
(st/emit! (dwt/update-position-data id position-data)))
|
(when (gsht/overlaps-position-data? shape position-data)
|
||||||
|
(st/emit! (dwt/update-position-data id position-data)))
|
||||||
|
|
||||||
(when (contains? #{:auto-height :auto-width} grow-type)
|
(when (contains? #{:auto-height :auto-width} grow-type)
|
||||||
(let [{:keys [width height]}
|
(let [{:keys [width height]}
|
||||||
(-> (dom/query node ".paragraph-set")
|
(-> (dom/query node ".paragraph-set")
|
||||||
(dom/get-bounding-rect))
|
(dom/get-bounding-rect))
|
||||||
|
|
||||||
width (mth/ceil width)
|
width (mth/ceil width)
|
||||||
height (mth/ceil height)]
|
height (mth/ceil height)]
|
||||||
(when (and (not (mth/almost-zero? width))
|
(when (and (not (mth/almost-zero? width))
|
||||||
(not (mth/almost-zero? height))
|
(not (mth/almost-zero? height))
|
||||||
(not migrate))
|
(not migrate))
|
||||||
(st/emit! (dwt/resize-text id width height)))))
|
(st/emit! (dwt/resize-text id width height)))))
|
||||||
|
|
||||||
(st/emit! (dwt/clean-text-modifier id))))
|
(st/emit! (dwt/clean-text-modifier id))))))
|
||||||
|
|
||||||
(defn- update-text-modifier
|
(defn- update-text-modifier
|
||||||
[{:keys [grow-type id] :as shape} node]
|
[{:keys [grow-type id] :as shape} node]
|
||||||
|
|
Loading…
Add table
Reference in a new issue