diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index f56bb31e83..06b44ffda2 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -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))) diff --git a/frontend/src/app/main/ui/shapes/group.cljs b/frontend/src/app/main/ui/shapes/group.cljs index 608cb0bc2e..6b4a5bf5c5 100644 --- a/frontend/src/app/main/ui/shapes/group.cljs +++ b/frontend/src/app/main/ui/shapes/group.cljs @@ -22,15 +22,16 @@ (mf/fnc group-shape {::mf/wrap-props false} [props] - (let [frame (unchecked-get props "frame") - shape (unchecked-get props "shape") - childs (unchecked-get props "childs") - mask (if (:masked-group? shape) - (first childs) - nil) - childs (if (:masked-group? shape) - (rest childs) - childs) + (let [frame (unchecked-get props "frame") + shape (unchecked-get props "shape") + childs (unchecked-get props "childs") + expand-mask (unchecked-get props "expand-mask") + mask (if (and (:masked-group? shape) (not expand-mask)) + (first childs) + nil) + childs (if (and (:masked-group? shape) (not expand-mask)) + (rest childs) + childs) is-child-selected? (unchecked-get props "is-child-selected?") {:keys [id x y width height]} shape transform (geom/transform-matrix shape)] diff --git a/frontend/src/app/main/ui/workspace/shapes/group.cljs b/frontend/src/app/main/ui/workspace/shapes/group.cljs index 0ef0d63bc0..d17f9c6644 100644 --- a/frontend/src/app/main/ui/workspace/shapes/group.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/group.cljs @@ -46,8 +46,8 @@ on-context-menu (mf/use-callback (mf/deps shape) #(common/on-context-menu % shape)) - childs-ref (mf/use-memo (mf/deps shape) #(refs/objects-by-id (:shapes shape))) - childs (mf/deref childs-ref) + childs-ref (mf/use-memo (mf/deps shape) #(refs/objects-by-id (:shapes shape))) + childs (mf/deref childs-ref) is-child-selected-ref (mf/use-memo (mf/deps (:id shape)) #(refs/is-child-selected? (:id shape))) @@ -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?}]]))))