diff --git a/common/src/app/common/geom/shapes/bool.cljc b/common/src/app/common/geom/shapes/bool.cljc index b0b47c057..93b7ccc72 100644 --- a/common/src/app/common/geom/shapes/bool.cljc +++ b/common/src/app/common/geom/shapes/bool.cljc @@ -7,6 +7,8 @@ (ns app.common.geom.shapes.bool (:require [app.common.geom.shapes.path :as gsp] + [app.common.geom.shapes.rect :as gpr] + [app.common.geom.shapes.transforms :as gtr] [app.common.path.bool :as pb] [app.common.path.shapes-to-path :as stp])) @@ -19,7 +21,12 @@ (mapv :content) (pb/content-bool (:bool-type shape))) - [points selrect] (gsp/content->points+selrect shape content)] + [points selrect] + (if (empty? content) + (let [selrect (gtr/selection-rect children) + points (gpr/rect->points selrect)] + [points selrect]) + (gsp/content->points+selrect shape content))] (-> shape (assoc :selrect selrect) (assoc :points points)))) diff --git a/common/src/app/common/geom/shapes/transforms.cljc b/common/src/app/common/geom/shapes/transforms.cljc index 7f9bfa7a5..56e6534e1 100644 --- a/common/src/app/common/geom/shapes/transforms.cljc +++ b/common/src/app/common/geom/shapes/transforms.cljc @@ -18,7 +18,6 @@ [app.common.spec :as us] [app.common.text :as txt])) - ;; --- Relative Movement (defn- move-selrect [selrect {dx :x dy :y}] @@ -681,3 +680,12 @@ (assoc :resize-transform (:resize-transform parent-modifiers) :resize-transform-inverse (:resize-transform-inverse parent-modifiers))))) + +(defn selection-rect + "Returns a rect that contains all the shapes and is aware of the + rotation of each shape. Mainly used for multiple selection." + [shapes] + (->> shapes + (transform-shape) + (map (comp gpr/points->selrect :points)) + (gpr/join-selrects))) diff --git a/frontend/src/app/main/ui/render.cljs b/frontend/src/app/main/ui/render.cljs index 44afd4010..cdb843181 100644 --- a/frontend/src/app/main/ui/render.cljs +++ b/frontend/src/app/main/ui/render.cljs @@ -79,7 +79,7 @@ text-shapes (->> objects - (filter (fn [[id shape]] (= :text (:type shape)))) + (filter (fn [[_ shape]] (= :text (:type shape)))) (mapv second))] (mf/use-effect