mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
Merge pull request #2585 from penpot/superalex-fix-show-board-miniature-in-manual-overlay-setting
🐛 Fix show board miniature in manual overlay setting
This commit is contained in:
commit
7c3f87d7b0
4 changed files with 19 additions and 9 deletions
|
@ -261,9 +261,17 @@ $height-palette-max: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.render-shapes {
|
.render-shapes {
|
||||||
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
}
|
||||||
|
|
||||||
|
.frame-thumbnail-wrapper {
|
||||||
|
.fills,
|
||||||
|
.strokes,
|
||||||
|
.frame-clip-def {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.viewport-controls {
|
.viewport-controls {
|
||||||
|
|
|
@ -418,7 +418,7 @@
|
||||||
elem-name (obj/get child "type")
|
elem-name (obj/get child "type")
|
||||||
position (or (obj/get props "position") 0)
|
position (or (obj/get props "position") 0)
|
||||||
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))]
|
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))]
|
||||||
[:g {:id (dm/fmt "fills-%" (:id shape))}
|
[:g.fills {:id (dm/fmt "fills-%" (:id shape))}
|
||||||
[:> elem-name (build-fill-props shape child position render-id)]]))
|
[:> elem-name (build-fill-props shape child position render-id)]]))
|
||||||
|
|
||||||
(mf/defc shape-strokes
|
(mf/defc shape-strokes
|
||||||
|
@ -442,7 +442,7 @@
|
||||||
[:*
|
[:*
|
||||||
(when
|
(when
|
||||||
(d/not-empty? (:strokes shape))
|
(d/not-empty? (:strokes shape))
|
||||||
[:> :g stroke-props
|
[:> :g.strokes stroke-props
|
||||||
(for [[index value] (-> (d/enumerate (:strokes shape)) reverse)]
|
(for [[index value] (-> (d/enumerate (:strokes shape)) reverse)]
|
||||||
(let [props (build-stroke-props index child value render-id)
|
(let [props (build-stroke-props index child value render-id)
|
||||||
shape (assoc value :points (:points shape))]
|
shape (assoc value :points (:points shape))]
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
:height height
|
:height height
|
||||||
:transform transform}))
|
:transform transform}))
|
||||||
path? (some? (.-d props))]
|
path? (some? (.-d props))]
|
||||||
[:clipPath {:id (frame-clip-id shape render-id) :class "frame-clip"}
|
[:clipPath.frame-clip-def {:id (frame-clip-id shape render-id) :class "frame-clip"}
|
||||||
(if path?
|
(if path?
|
||||||
[:> :path props]
|
[:> :path props]
|
||||||
[:> :rect props])])))
|
[:> :rect props])])))
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
(let [canvas-context (.getContext canvas-node "2d")
|
(let [canvas-context (.getContext canvas-node "2d")
|
||||||
canvas-width (.-width canvas-node)
|
canvas-width (.-width canvas-node)
|
||||||
canvas-height (.-height canvas-node)]
|
canvas-height (.-height canvas-node)]
|
||||||
|
|
||||||
(.clearRect canvas-context 0 0 canvas-width canvas-height)
|
(.clearRect canvas-context 0 0 canvas-width canvas-height)
|
||||||
(.drawImage canvas-context img-node 0 0 canvas-width canvas-height)
|
(.drawImage canvas-context img-node 0 0 canvas-width canvas-height)
|
||||||
true))
|
true))
|
||||||
|
@ -92,6 +91,8 @@
|
||||||
;; State variable to select whether we show the image thumbnail or the canvas thumbnail
|
;; State variable to select whether we show the image thumbnail or the canvas thumbnail
|
||||||
show-frame-thumbnail (mf/use-state (some? thumbnail-data))
|
show-frame-thumbnail (mf/use-state (some? thumbnail-data))
|
||||||
|
|
||||||
|
disable-fills? (or @show-frame-thumbnail (some? @image-url))
|
||||||
|
|
||||||
on-image-load
|
on-image-load
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(fn []
|
(fn []
|
||||||
|
@ -99,8 +100,6 @@
|
||||||
#(let [canvas-node (mf/ref-val frame-canvas-ref)
|
#(let [canvas-node (mf/ref-val frame-canvas-ref)
|
||||||
img-node (mf/ref-val frame-image-ref)]
|
img-node (mf/ref-val frame-image-ref)]
|
||||||
(when (draw-thumbnail-canvas! canvas-node img-node)
|
(when (draw-thumbnail-canvas! canvas-node img-node)
|
||||||
(reset! image-url nil)
|
|
||||||
|
|
||||||
(when @show-frame-thumbnail
|
(when @show-frame-thumbnail
|
||||||
(reset! show-frame-thumbnail false))
|
(reset! show-frame-thumbnail false))
|
||||||
;; If we don't have the thumbnail data saved (normally the first load) we update the data
|
;; If we don't have the thumbnail data saved (normally the first load) we update the data
|
||||||
|
@ -229,8 +228,11 @@
|
||||||
(some? thumbnail-data)
|
(some? thumbnail-data)
|
||||||
(assoc :thumbnail thumbnail-data))}])
|
(assoc :thumbnail thumbnail-data))}])
|
||||||
|
|
||||||
|
[:foreignObject {:x x
|
||||||
[:foreignObject {:x x :y y :width width :height height}
|
:y y
|
||||||
|
:width width
|
||||||
|
:height height
|
||||||
|
:opacity (when disable-fills? 0)}
|
||||||
[:canvas.thumbnail-canvas
|
[:canvas.thumbnail-canvas
|
||||||
{:key (dm/str "thumbnail-canvas-" (:id shape))
|
{:key (dm/str "thumbnail-canvas-" (:id shape))
|
||||||
:ref frame-canvas-ref
|
:ref frame-canvas-ref
|
||||||
|
|
Loading…
Reference in a new issue