mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
Match selrect selection by overlap instead of strictly contained-in.
This commit is contained in:
parent
4ba4fb3acb
commit
bb0b616cb3
2 changed files with 13 additions and 0 deletions
|
@ -286,6 +286,9 @@
|
||||||
(geom/contained-in? shape selrect)
|
(geom/contained-in? shape selrect)
|
||||||
(conj acc id)
|
(conj acc id)
|
||||||
|
|
||||||
|
(geom/overlaps? shape selrect)
|
||||||
|
(conj acc id)
|
||||||
|
|
||||||
(:locked shape)
|
(:locked shape)
|
||||||
acc
|
acc
|
||||||
|
|
||||||
|
|
|
@ -564,3 +564,13 @@
|
||||||
(neg? (- sx1 rx1))
|
(neg? (- sx1 rx1))
|
||||||
(pos? (- sy2 ry2))
|
(pos? (- sy2 ry2))
|
||||||
(pos? (- sx2 rx2)))))
|
(pos? (- sx2 rx2)))))
|
||||||
|
|
||||||
|
(defn overlaps?
|
||||||
|
"Check if a shape overlaps with provided selection rect."
|
||||||
|
[shape selrect]
|
||||||
|
(let [{sx1 :x1 sx2 :x2 sy1 :y1 sy2 :y2} selrect
|
||||||
|
{rx1 :x1 rx2 :x2 ry1 :y1 ry2 :y2} shape]
|
||||||
|
(and (< rx1 sx2)
|
||||||
|
(> rx2 sx1)
|
||||||
|
(< ry1 sy2)
|
||||||
|
(> ry2 sy1))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue