diff --git a/frontend/src/uxbox/main/data/shapes_impl.cljs b/frontend/src/uxbox/main/data/shapes_impl.cljs index 1c54113561..598445bf4a 100644 --- a/frontend/src/uxbox/main/data/shapes_impl.cljs +++ b/frontend/src/uxbox/main/data/shapes_impl.cljs @@ -286,6 +286,9 @@ (geom/contained-in? shape selrect) (conj acc id) + (geom/overlaps? shape selrect) + (conj acc id) + (:locked shape) acc diff --git a/frontend/src/uxbox/main/geom.cljs b/frontend/src/uxbox/main/geom.cljs index 37f19623b3..9ee43c887c 100644 --- a/frontend/src/uxbox/main/geom.cljs +++ b/frontend/src/uxbox/main/geom.cljs @@ -564,3 +564,13 @@ (neg? (- sx1 rx1)) (pos? (- sy2 ry2)) (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))))