mirror of
https://github.com/penpot/penpot.git
synced 2025-06-16 17:21:40 +02:00
✨ Expand mask when selected in workspace
This commit is contained in:
parent
0ddf6d30b8
commit
823aa426ed
3 changed files with 23 additions and 13 deletions
|
@ -159,7 +159,6 @@
|
|||
(let [page-id (:current-page-id state)
|
||||
objects (get-in state [:workspace-data :pages-index page-id :objects])
|
||||
selected (get-in state [:workspace-local :selected])
|
||||
shape (get objects id)
|
||||
children (cph/get-children id objects)]
|
||||
(some selected children)))]
|
||||
(l/derived selector st/state)))
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
(let [frame (unchecked-get props "frame")
|
||||
shape (unchecked-get props "shape")
|
||||
childs (unchecked-get props "childs")
|
||||
mask (if (:masked-group? shape)
|
||||
expand-mask (unchecked-get props "expand-mask")
|
||||
mask (if (and (:masked-group? shape) (not expand-mask))
|
||||
(first childs)
|
||||
nil)
|
||||
childs (if (:masked-group? shape)
|
||||
childs (if (and (:masked-group? shape) (not expand-mask))
|
||||
(rest childs)
|
||||
childs)
|
||||
is-child-selected? (unchecked-get props "is-child-selected?")
|
||||
|
|
|
@ -55,6 +55,15 @@
|
|||
is-child-selected?
|
||||
(mf/deref is-child-selected-ref)
|
||||
|
||||
mask-id (when (:masked-group? shape) (first (:shapes shape)))
|
||||
|
||||
is-mask-selected-ref
|
||||
(mf/use-memo (mf/deps mask-id)
|
||||
#(refs/make-selected-ref mask-id))
|
||||
|
||||
is-mask-selected?
|
||||
(mf/deref is-mask-selected-ref)
|
||||
|
||||
on-double-click
|
||||
(mf/use-callback
|
||||
(mf/deps (:id shape))
|
||||
|
@ -72,5 +81,6 @@
|
|||
{:frame frame
|
||||
:shape shape
|
||||
:childs childs
|
||||
:is-child-selected? is-child-selected?}]]))))
|
||||
:is-child-selected? is-child-selected?
|
||||
:expand-mask is-mask-selected?}]]))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue