mirror of
https://github.com/penpot/penpot.git
synced 2026-05-14 20:43:55 +00:00
🐛 Fix problem with preview version in svg render (#9626)
This commit is contained in:
parent
eec05271e0
commit
c752e194d6
@ -34,12 +34,14 @@
|
||||
|
||||
on-accept
|
||||
(mf/use-fn
|
||||
(mf/deps on-accept)
|
||||
(fn [e]
|
||||
(when (fn? on-accept)
|
||||
(on-accept e))))
|
||||
|
||||
on-cancel
|
||||
(mf/use-fn
|
||||
(mf/deps on-cancel)
|
||||
(fn [e]
|
||||
(when on-cancel (on-cancel e))))]
|
||||
|
||||
|
||||
@ -60,10 +60,11 @@
|
||||
{::mf/wrap [mf/memo]
|
||||
::mf/wrap-props false}
|
||||
[props]
|
||||
(let [objects (obj/get props "objects")
|
||||
active-frames (obj/get props "active-frames")
|
||||
shapes (cfh/get-immediate-children objects)
|
||||
vbox (mf/use-ctx ctx/current-vbox)
|
||||
(let [objects (obj/get props "objects")
|
||||
active-frames (obj/get props "active-frames")
|
||||
disable-thumbnails (obj/get props "disable-thumbnails")
|
||||
shapes (cfh/get-immediate-children objects)
|
||||
vbox (mf/use-ctx ctx/current-vbox)
|
||||
|
||||
frame-overlap? (mf/with-memo [vbox objects]
|
||||
#(make-is-frame-overlap vbox objects))
|
||||
@ -84,13 +85,16 @@
|
||||
|
||||
[:g.frame-children
|
||||
(for [shape shapes]
|
||||
[:g.ws-shape-wrapper {:key (dm/str (dm/get-prop shape :id))}
|
||||
(if ^boolean (cfh/frame-shape? shape)
|
||||
[:& root-frame-wrapper
|
||||
{:shape shape
|
||||
:objects objects
|
||||
:thumbnail? (not (contains? active-frames (dm/get-prop shape :id)))}]
|
||||
[:& shape-wrapper {:shape shape}])])]]]))
|
||||
(let [thumbnail?
|
||||
(and (not disable-thumbnails)
|
||||
(contains? active-frames (dm/get-prop shape :id)))]
|
||||
[:g.ws-shape-wrapper {:key (dm/str (dm/get-prop shape :id))}
|
||||
(if ^boolean (cfh/frame-shape? shape)
|
||||
[:& root-frame-wrapper
|
||||
{:shape shape
|
||||
:objects objects
|
||||
:thumbnail? thumbnail?}]
|
||||
[:& shape-wrapper {:shape shape}])]))]]]))
|
||||
|
||||
(mf/defc shape-wrapper
|
||||
{::mf/wrap [#(mf/memo' % common/check-shape-props)]
|
||||
|
||||
@ -410,7 +410,9 @@
|
||||
;; Render root shape
|
||||
[:& shapes/root-shape {:key (str page-id)
|
||||
:objects base-objects
|
||||
:active-frames @active-frames}]]]]
|
||||
:active-frames @active-frames
|
||||
;; disable thumbnails when previewing a version
|
||||
:disable-thumbnails (some? preview-id)}]]]]
|
||||
|
||||
[:svg.viewport-controls
|
||||
{:xmlns "http://www.w3.org/2000/svg"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user