mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 15:11:47 +02:00
✨ Add context menu to all shapes.
This commit is contained in:
parent
cae5b5e778
commit
06ec1e00ee
2 changed files with 31 additions and 28 deletions
|
@ -24,17 +24,18 @@
|
|||
(mf/defc path-wrapper
|
||||
[{:keys [shape] :as props}]
|
||||
(let [selected (mf/deref refs/selected-shapes)
|
||||
selected? (contains? selected (:id shape))]
|
||||
(letfn [(on-mouse-down [event]
|
||||
(common/on-mouse-down event shape selected))
|
||||
(on-double-click [event]
|
||||
(when selected?
|
||||
(st/emit! (dw/start-edition-mode (:id shape)))))]
|
||||
[:g.shape {:class (when selected? "selected")
|
||||
:on-double-click on-double-click
|
||||
:on-mouse-down on-mouse-down}
|
||||
[:& path-shape {:shape shape
|
||||
:background? true}]])))
|
||||
selected? (contains? selected (:id shape))
|
||||
on-mouse-down #(common/on-mouse-down % shape)
|
||||
on-context-menu #(common/on-context-menu % shape)
|
||||
on-double-click
|
||||
(fn [event]
|
||||
(when selected?
|
||||
(st/emit! (dw/start-edition-mode (:id shape)))))]
|
||||
[:g.shape {:on-double-click on-double-click
|
||||
:on-mouse-down on-mouse-down
|
||||
:on-context-menu on-context-menu}
|
||||
[:& path-shape {:shape shape
|
||||
:background? true}]]))
|
||||
|
||||
;; --- Path Shape
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue