mirror of
https://github.com/penpot/penpot.git
synced 2025-07-29 09:27:22 +02:00
🐛 Fix render-frame when shape is nil
This commit is contained in:
parent
db149e9c09
commit
9c9bc8803d
1 changed files with 36 additions and 33 deletions
|
@ -538,42 +538,45 @@
|
||||||
|
|
||||||
(defn render-frame
|
(defn render-frame
|
||||||
[objects shape object-id]
|
[objects shape object-id]
|
||||||
(let [shape-id (dm/get-prop shape :id)
|
(if (some? shape)
|
||||||
fonts (ff/shape->fonts shape objects)
|
(let [shape-id (dm/get-prop shape :id)
|
||||||
|
fonts (ff/shape->fonts shape objects)
|
||||||
|
|
||||||
bounds (if (:show-content shape)
|
bounds (if (:show-content shape)
|
||||||
(let [ids (cph/get-children-ids objects shape-id)
|
(let [ids (cph/get-children-ids objects shape-id)
|
||||||
children (sequence (keep (d/getf objects)) ids)]
|
children (sequence (keep (d/getf objects)) ids)]
|
||||||
(gsh/shapes->rect (cons shape children)))
|
(gsh/shapes->rect (cons shape children)))
|
||||||
(-> shape :points grc/points->rect))
|
(-> shape :points grc/points->rect))
|
||||||
|
|
||||||
x (dm/get-prop bounds :x)
|
x (dm/get-prop bounds :x)
|
||||||
y (dm/get-prop bounds :y)
|
y (dm/get-prop bounds :y)
|
||||||
width (dm/get-prop bounds :width)
|
width (dm/get-prop bounds :width)
|
||||||
height (dm/get-prop bounds :height)
|
height (dm/get-prop bounds :height)
|
||||||
|
|
||||||
viewbox (str/ffmt "% % % %" x y width height)
|
viewbox (str/ffmt "% % % %" x y width height)
|
||||||
|
|
||||||
[fixed-width
|
[fixed-width
|
||||||
fixed-height] (th/get-proportional-size width height)
|
fixed-height] (th/get-proportional-size width height)
|
||||||
|
|
||||||
data (rds/renderToStaticMarkup
|
data (rds/renderToStaticMarkup
|
||||||
(mf/element frame-imposter
|
(mf/element frame-imposter
|
||||||
#js {:objects objects
|
#js {:objects objects
|
||||||
:frame shape
|
:frame shape
|
||||||
:vbox viewbox
|
:vbox viewbox
|
||||||
:width width
|
:width width
|
||||||
:height height}))]
|
:height height}))]
|
||||||
|
|
||||||
(->> (fonts/render-font-styles-cached fonts)
|
(->> (fonts/render-font-styles-cached fonts)
|
||||||
(rx/catch (fn [cause]
|
(rx/catch (fn [cause]
|
||||||
(l/err :hint "unexpected error on rendering imposter"
|
(l/err :hint "unexpected error on rendering imposter"
|
||||||
:cause cause)
|
:cause cause)
|
||||||
(rx/empty)))
|
(rx/empty)))
|
||||||
(rx/map (fn [styles]
|
(rx/map (fn [styles]
|
||||||
{:id object-id
|
{:id object-id
|
||||||
:data data
|
:data data
|
||||||
:viewbox viewbox
|
:viewbox viewbox
|
||||||
:width fixed-width
|
:width fixed-width
|
||||||
:height fixed-height
|
:height fixed-height
|
||||||
:styles styles})))))
|
:styles styles}))))
|
||||||
|
(do (l/warn :msg "imposter shape is nil")
|
||||||
|
(rx/empty))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue