mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 14:28:20 +02:00
✨ Fix problem with booleans selection (#6950)
This commit is contained in:
parent
b477ca0508
commit
dfc8a1da4a
5 changed files with 14 additions and 27 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fix problem with booleans selection [Taiga #11627](https://tree.taiga.io/project/penpot/issue/11627)
|
||||||
|
|
||||||
## 2.9.0 (Unreleased)
|
## 2.9.0 (Unreleased)
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,14 @@
|
||||||
get-clip-parents
|
get-clip-parents
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(cond-> []
|
(cond-> []
|
||||||
(and (= :frame (:type shape))
|
(or (and (= :frame (:type shape))
|
||||||
(not (:show-content shape))
|
(not (:show-content shape))
|
||||||
(not= uuid/zero (:id shape)))
|
(not= uuid/zero (:id shape)))
|
||||||
|
(cfh/bool-shape? shape))
|
||||||
(conj shape)
|
(conj shape)
|
||||||
|
|
||||||
(:masked-group shape)
|
(:masked-group shape)
|
||||||
(conj (get objects (->> shape :shapes first)))
|
(conj (get objects (->> shape :shapes first)))))]
|
||||||
|
|
||||||
(= :bool (:type shape))
|
|
||||||
(conj shape)))]
|
|
||||||
|
|
||||||
(into []
|
(into []
|
||||||
(comp (map lookup-object)
|
(comp (map lookup-object)
|
||||||
|
|
|
@ -315,7 +315,8 @@
|
||||||
(update :height + (* 2 swidth)))]
|
(update :height + (* 2 swidth)))]
|
||||||
(or (not shape)
|
(or (not shape)
|
||||||
(cond
|
(cond
|
||||||
(cfh/path-shape? shape)
|
(or (cfh/path-shape? shape)
|
||||||
|
(cfh/bool-shape? shape))
|
||||||
(and (overlaps-rect-points? rect (:points shape))
|
(and (overlaps-rect-points? rect (:points shape))
|
||||||
(overlaps-path? shape rect true))
|
(overlaps-path? shape rect true))
|
||||||
|
|
||||||
|
|
|
@ -171,19 +171,6 @@
|
||||||
(dw/decrease-zoom)
|
(dw/decrease-zoom)
|
||||||
(dw/increase-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
|
(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?]
|
[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
|
(let [;; We use ref so we don't recreate the stream on a change
|
||||||
|
@ -211,7 +198,7 @@
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:rect rect
|
:rect rect
|
||||||
:include-frames? true
|
:include-frames? true
|
||||||
:clip-children? true
|
:clip-children? (not (mf/ref-val mod-ref))
|
||||||
:using-selrect? false})
|
:using-selrect? false})
|
||||||
;; When the ask-buffered is canceled returns null. We filter them
|
;; When the ask-buffered is canceled returns null. We filter them
|
||||||
;; to improve the behavior
|
;; to improve the behavior
|
||||||
|
@ -297,7 +284,7 @@
|
||||||
|
|
||||||
grouped?
|
grouped?
|
||||||
(fn [id]
|
(fn [id]
|
||||||
(and (cfh/group-shape? objects id)
|
(and (cfh/group-like-shape? objects id)
|
||||||
(not (cfh/mask-shape? objects id))))
|
(not (cfh/mask-shape? objects id))))
|
||||||
|
|
||||||
selected-with-parents
|
selected-with-parents
|
||||||
|
@ -319,11 +306,11 @@
|
||||||
(not mod?)
|
(not mod?)
|
||||||
(let [child-parent?
|
(let [child-parent?
|
||||||
(into #{}
|
(into #{}
|
||||||
(comp (remove #(cfh/group-like-shape? objects %))
|
(comp (remove #(cfh/group-shape? objects %))
|
||||||
(mapcat #(cfh/get-parent-ids objects %)))
|
(mapcat #(cfh/get-parent-ids objects %)))
|
||||||
ids)]
|
ids)]
|
||||||
(filter #(or (root-frame-with-data? %)
|
(filter #(or (root-frame-with-data? %)
|
||||||
(and (contains? #{:group :bool} (dm/get-in objects [% :type]))
|
(and (cfh/group-shape? objects %)
|
||||||
(not (contains? child-parent? %)))))))
|
(not (contains? child-parent? %)))))))
|
||||||
|
|
||||||
remove-measure-xf
|
remove-measure-xf
|
||||||
|
@ -337,7 +324,7 @@
|
||||||
(comp (remove #(cfh/group-like-shape? objects %))
|
(comp (remove #(cfh/group-like-shape? objects %))
|
||||||
(mapcat #(cfh/get-parent-ids objects %)))
|
(mapcat #(cfh/get-parent-ids objects %)))
|
||||||
ids)]
|
ids)]
|
||||||
(filter #(and (contains? #{:group :bool} (dm/get-in objects [% :type]))
|
(filter #(and (cfh/group-shape? objects %)
|
||||||
(not (contains? child-parent? %))))))
|
(not (contains? child-parent? %))))))
|
||||||
|
|
||||||
remove-hover?
|
remove-hover?
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
;; If the shape has no fills the overlap depends on the stroke
|
;; If the shape has no fills the overlap depends on the stroke
|
||||||
:rect (and (overlaps-outer-shape? shape) (not (overlaps-inner-shape? shape)))
|
:rect (and (overlaps-outer-shape? shape) (not (overlaps-inner-shape? shape)))
|
||||||
:circle (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))
|
||||||
(gsh/overlaps? shape rect)))
|
(gsh/overlaps? shape rect)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue