0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-11 06:21:30 -05:00

🐛 Fix render-frame when shape is nil

This commit is contained in:
Aitor 2023-09-28 16:42:09 +02:00 committed by Andrés Moya
parent db149e9c09
commit 9c9bc8803d

View file

@ -538,42 +538,45 @@
(defn render-frame
[objects shape object-id]
(let [shape-id (dm/get-prop shape :id)
fonts (ff/shape->fonts shape objects)
(if (some? shape)
(let [shape-id (dm/get-prop shape :id)
fonts (ff/shape->fonts shape objects)
bounds (if (:show-content shape)
(let [ids (cph/get-children-ids objects shape-id)
children (sequence (keep (d/getf objects)) ids)]
(gsh/shapes->rect (cons shape children)))
(-> shape :points grc/points->rect))
bounds (if (:show-content shape)
(let [ids (cph/get-children-ids objects shape-id)
children (sequence (keep (d/getf objects)) ids)]
(gsh/shapes->rect (cons shape children)))
(-> shape :points grc/points->rect))
x (dm/get-prop bounds :x)
y (dm/get-prop bounds :y)
width (dm/get-prop bounds :width)
height (dm/get-prop bounds :height)
x (dm/get-prop bounds :x)
y (dm/get-prop bounds :y)
width (dm/get-prop bounds :width)
height (dm/get-prop bounds :height)
viewbox (str/ffmt "% % % %" x y width height)
viewbox (str/ffmt "% % % %" x y width height)
[fixed-width
fixed-height] (th/get-proportional-size width height)
[fixed-width
fixed-height] (th/get-proportional-size width height)
data (rds/renderToStaticMarkup
(mf/element frame-imposter
#js {:objects objects
:frame shape
:vbox viewbox
:width width
:height height}))]
data (rds/renderToStaticMarkup
(mf/element frame-imposter
#js {:objects objects
:frame shape
:vbox viewbox
:width width
:height height}))]
(->> (fonts/render-font-styles-cached fonts)
(rx/catch (fn [cause]
(l/err :hint "unexpected error on rendering imposter"
:cause cause)
(rx/empty)))
(rx/map (fn [styles]
{:id object-id
:data data
:viewbox viewbox
:width fixed-width
:height fixed-height
:styles styles})))))
(->> (fonts/render-font-styles-cached fonts)
(rx/catch (fn [cause]
(l/err :hint "unexpected error on rendering imposter"
:cause cause)
(rx/empty)))
(rx/map (fn [styles]
{:id object-id
:data data
:viewbox viewbox
:width fixed-width
:height fixed-height
:styles styles}))))
(do (l/warn :msg "imposter shape is nil")
(rx/empty))))