diff --git a/common/uxbox/common/geom/shapes.cljc b/common/uxbox/common/geom/shapes.cljc index 4b96e7dff..8f63639af 100644 --- a/common/uxbox/common/geom/shapes.cljc +++ b/common/uxbox/common/geom/shapes.cljc @@ -227,14 +227,11 @@ (defn- setup-image [{:keys [metadata] :as shape} {:keys [x y width height] :as props}] - (assoc shape - :x x - :y y - :width width - :height height - :proportion (/ (:width metadata) - (:height metadata)) - :proportion-lock true)) + (-> (setup-rect shape props) + (assoc + :proportion (/ (:width metadata) + (:height metadata)) + :proportion-lock true))) ;; --- Coerce to Rect-like shape. diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index 366345735..704d07c8f 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -1209,21 +1209,23 @@ (when (not-empty selected) (let [page-id (get-in state [:workspace-page :id]) objects (get-in state [:workspace-data page-id :objects]) + selected-objects (map (partial get objects) selected) - selection-rect (geom/selection-rect selected-objects) + selrect (geom/selection-rect selected-objects) frame-id (-> selected-objects first :frame-id) - group-shape (group-shape id frame-id selected selection-rect) - frame-children (get-in objects [frame-id :shapes]) - index-frame (->> frame-children - (map-indexed vector) - (filter #(selected (second %))) - (ffirst)) + group (-> (group-shape id frame-id selected selrect) + (geom/setup selrect)) + + index (->> (get-in objects [frame-id :shapes]) + (map-indexed vector) + (filter #(selected (second %))) + (ffirst)) rchanges [{:type :add-obj :id id :frame-id frame-id - :obj group-shape - :index index-frame} + :obj group + :index index} {:type :mov-objects :parent-id id :shapes (vec selected)}]