mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 15:01:39 +02:00
🐛 Fix problem when moving shape inside frame
This commit is contained in:
parent
93726cf8fe
commit
00fbfd6e9e
2 changed files with 9 additions and 7 deletions
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
(mf/defc frame-clip-def
|
(mf/defc frame-clip-def
|
||||||
[{:keys [shape render-id]}]
|
[{:keys [shape render-id]}]
|
||||||
(when (= :frame (:type shape))
|
(when (and (= :frame (:type shape)) (not (:show-content shape)))
|
||||||
(let [{:keys [x y width height]} shape
|
(let [{:keys [x y width height]} shape
|
||||||
transform (gsh/transform-str shape)
|
transform (gsh/transform-str shape)
|
||||||
props (-> (attrs/extract-style-attrs shape)
|
props (-> (attrs/extract-style-attrs shape)
|
||||||
|
@ -66,8 +66,7 @@
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
[:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))}
|
[:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))}
|
||||||
(when (not show-content)
|
[:& frame-clip-def {:shape shape :render-id render-id}]
|
||||||
[:& frame-clip-def {:shape shape :render-id render-id}])
|
|
||||||
|
|
||||||
[:& shape-fills {:shape shape}
|
[:& shape-fills {:shape shape}
|
||||||
(if path?
|
(if path?
|
||||||
|
|
|
@ -224,10 +224,9 @@
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps add-children)
|
(mf/deps add-children)
|
||||||
(fn []
|
(fn []
|
||||||
(doseq [{:keys [frame shape]} add-children-prev]
|
(doseq [{:keys [shape]} add-children-prev]
|
||||||
(let [frame-node (get-shape-node node frame)
|
(let [shape-node (get-shape-node shape)
|
||||||
shape-node (get-shape-node shape)
|
mirror-node (dom/query (dm/fmt ".mirror-shape[href='#shape-%'" shape))]
|
||||||
mirror-node (dom/query frame-node (dm/fmt ".mirror-shape[href='#shape-%'" shape))]
|
|
||||||
(when mirror-node (.remove mirror-node))
|
(when mirror-node (.remove mirror-node))
|
||||||
(dom/remove-attribute! (dom/get-parent shape-node) "display")))
|
(dom/remove-attribute! (dom/get-parent shape-node) "display")))
|
||||||
|
|
||||||
|
@ -235,6 +234,9 @@
|
||||||
(let [frame-node (get-shape-node frame)
|
(let [frame-node (get-shape-node frame)
|
||||||
shape-node (get-shape-node shape)
|
shape-node (get-shape-node shape)
|
||||||
|
|
||||||
|
clip-id
|
||||||
|
(dom/get-attribute (dom/query frame-node ":scope > defs > .frame-clip-def") "id")
|
||||||
|
|
||||||
use-node
|
use-node
|
||||||
(.createElementNS globals/document "http://www.w3.org/2000/svg" "use")
|
(.createElementNS globals/document "http://www.w3.org/2000/svg" "use")
|
||||||
|
|
||||||
|
@ -242,6 +244,7 @@
|
||||||
(or (dom/query frame-node ".frame-children") frame-node)]
|
(or (dom/query frame-node ".frame-children") frame-node)]
|
||||||
|
|
||||||
(dom/set-attribute! use-node "href" (dm/fmt "#shape-%" shape))
|
(dom/set-attribute! use-node "href" (dm/fmt "#shape-%" shape))
|
||||||
|
(dom/set-attribute! use-node "clip-path" (dm/fmt "url(#%)" clip-id))
|
||||||
(dom/add-class! use-node "mirror-shape")
|
(dom/add-class! use-node "mirror-shape")
|
||||||
(dom/append-child! contents-node use-node)
|
(dom/append-child! contents-node use-node)
|
||||||
(dom/set-attribute! (dom/get-parent shape-node) "display" "none")))))
|
(dom/set-attribute! (dom/get-parent shape-node) "display" "none")))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue