diff --git a/CHANGES.md b/CHANGES.md index 51a4e95d33..f585799b2a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ ### :bug: Bugs fixed +- Fix problem with booleans selection [Taiga #11627](https://tree.taiga.io/project/penpot/issue/11627) ## 2.9.0 (Unreleased) diff --git a/common/src/app/common/files/indices.cljc b/common/src/app/common/files/indices.cljc index 032762c0a5..5dc13e3eaa 100644 --- a/common/src/app/common/files/indices.cljc +++ b/common/src/app/common/files/indices.cljc @@ -30,16 +30,14 @@ get-clip-parents (fn [shape] (cond-> [] - (and (= :frame (:type shape)) - (not (:show-content shape)) - (not= uuid/zero (:id shape))) + (or (and (= :frame (:type shape)) + (not (:show-content shape)) + (not= uuid/zero (:id shape))) + (cfh/bool-shape? shape)) (conj shape) (:masked-group shape) - (conj (get objects (->> shape :shapes first))) - - (= :bool (:type shape)) - (conj shape)))] + (conj (get objects (->> shape :shapes first)))))] (into [] (comp (map lookup-object) diff --git a/common/src/app/common/geom/shapes/intersect.cljc b/common/src/app/common/geom/shapes/intersect.cljc index 1bf11f87e7..60a62ce9c4 100644 --- a/common/src/app/common/geom/shapes/intersect.cljc +++ b/common/src/app/common/geom/shapes/intersect.cljc @@ -315,7 +315,8 @@ (update :height + (* 2 swidth)))] (or (not shape) (cond - (cfh/path-shape? shape) + (or (cfh/path-shape? shape) + (cfh/bool-shape? shape)) (and (overlaps-rect-points? rect (:points shape)) (overlaps-path? shape rect true)) diff --git a/frontend/src/app/main/ui/workspace/viewport/hooks.cljs b/frontend/src/app/main/ui/workspace/viewport/hooks.cljs index 0551cde8fe..b49699e7f0 100644 --- a/frontend/src/app/main/ui/workspace/viewport/hooks.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/hooks.cljs @@ -171,19 +171,6 @@ (dw/decrease-zoom) (dw/increase-zoom))))))) - -(defn group-empty-space? - "Given a group `group-id` check if `hover-ids` contains any of its children. If it doesn't means - we're hovering over empty space for the group " - [group-id objects hover-ids] - - (and (contains? #{:group :bool} (get-in objects [group-id :type])) - ;; If there are no children in the hover-ids we're in the empty side - (->> hover-ids - (remove #(contains? #{:group :bool} (get-in objects [% :type]))) - (some #(cfh/is-parent? objects % group-id)) - (not)))) - (defn setup-hover-shapes [page-id move-stream objects transform selected mod? hover measure-hover hover-ids hover-top-frame-id hover-disabled? focus zoom show-measures?] (let [;; We use ref so we don't recreate the stream on a change @@ -211,7 +198,7 @@ :page-id page-id :rect rect :include-frames? true - :clip-children? true + :clip-children? (not (mf/ref-val mod-ref)) :using-selrect? false}) ;; When the ask-buffered is canceled returns null. We filter them ;; to improve the behavior @@ -297,7 +284,7 @@ grouped? (fn [id] - (and (cfh/group-shape? objects id) + (and (cfh/group-like-shape? objects id) (not (cfh/mask-shape? objects id)))) selected-with-parents @@ -319,11 +306,11 @@ (not mod?) (let [child-parent? (into #{} - (comp (remove #(cfh/group-like-shape? objects %)) + (comp (remove #(cfh/group-shape? objects %)) (mapcat #(cfh/get-parent-ids objects %))) ids)] (filter #(or (root-frame-with-data? %) - (and (contains? #{:group :bool} (dm/get-in objects [% :type])) + (and (cfh/group-shape? objects %) (not (contains? child-parent? %))))))) remove-measure-xf @@ -337,7 +324,7 @@ (comp (remove #(cfh/group-like-shape? objects %)) (mapcat #(cfh/get-parent-ids objects %))) ids)] - (filter #(and (contains? #{:group :bool} (dm/get-in objects [% :type])) + (filter #(and (cfh/group-shape? objects %) (not (contains? child-parent? %)))))) remove-hover? diff --git a/frontend/src/app/worker/selection.cljs b/frontend/src/app/worker/selection.cljs index bf4b060356..f6a917b003 100644 --- a/frontend/src/app/worker/selection.cljs +++ b/frontend/src/app/worker/selection.cljs @@ -212,7 +212,7 @@ ;; If the shape has no fills the overlap depends on the stroke :rect (and (overlaps-outer-shape? shape) (not (overlaps-inner-shape? shape))) :circle (and (overlaps-outer-shape? shape) (not (overlaps-inner-shape? shape))) - :path (overlaps-path? shape) + (:bool :path) (overlaps-path? shape) (gsh/overlaps? shape rect)) (gsh/overlaps? shape rect)))