diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index 26e584e897..843d2191df 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -1505,7 +1505,7 @@ (let [page-id (::page-id state) objects (get-in state [:workspace-data page-id :objects]) - ;; Updates the displacement data for a single shape + ;; Updates the resize data for a single shape materialize-shape (fn [state id mtx] (update-in @@ -1525,9 +1525,11 @@ (fn [state id] (let [shape (get objects id) mtx (:resize-modifier shape (gmt/matrix))] - (-> state - (materialize-shape id mtx) - (materialize-children id mtx))))] + (if (= (:type shape) :frame) + (materialize-shape state id mtx) + (-> state + (materialize-shape id mtx) + (materialize-children id mtx)))))] (reduce update-shapes state ids))) ptk/WatchEvent @@ -1628,7 +1630,7 @@ (dissoc :displacement-modifier) (geom/transform xfmt)) - shapes (->> (:shapes frame) + shapes (->> (helpers/get-children id objects) (map #(get objects %)) (map #(geom/transform % xfmt)) (d/index-by :id)) diff --git a/frontend/src/uxbox/main/geom.cljs b/frontend/src/uxbox/main/geom.cljs index 43d33730bd..b8023a0645 100644 --- a/frontend/src/uxbox/main/geom.cljs +++ b/frontend/src/uxbox/main/geom.cljs @@ -588,12 +588,13 @@ (> ry2 sy1)))) (defn transform-shape - [frame shape] - (let [ds-modifier (:displacement-modifier shape) - rz-modifier (:resize-modifier shape) - ds-modifier' (:displacement-modifier frame)] - (cond-> shape - (gmt/matrix? ds-modifier') (transform ds-modifier') - (gmt/matrix? rz-modifier) (transform rz-modifier) - frame (move (gpt/point (- (:x frame)) (- (:y frame)))) - (gmt/matrix? ds-modifier) (transform ds-modifier)))) + ([shape] (transform-shape nil shape)) + ([frame shape] + (let [ds-modifier (:displacement-modifier shape) + rz-modifier (:resize-modifier shape) + frame-ds-modifier (:displacement-modifier frame)] + (cond-> shape + (gmt/matrix? rz-modifier) (transform rz-modifier) + frame (move (gpt/point (- (:x frame)) (- (:y frame)))) + (gmt/matrix? frame-ds-modifier) (transform frame-ds-modifier) + (gmt/matrix? ds-modifier) (transform ds-modifier))))) diff --git a/frontend/src/uxbox/main/ui/shapes/frame.cljs b/frontend/src/uxbox/main/ui/shapes/frame.cljs index 4e2e460884..87a4f43367 100644 --- a/frontend/src/uxbox/main/ui/shapes/frame.cljs +++ b/frontend/src/uxbox/main/ui/shapes/frame.cljs @@ -102,17 +102,11 @@ [:& frame-shape {:shape shape :childs childs}]]))))) -(defn frame-shape +(defn frame-shape [shape-wrapper] (mf/fnc frame-shape [{:keys [shape childs] :as props}] - (let [rotation (:rotation shape) - ds-modifier (:displacement-modifier shape) - rz-modifier (:resize-modifier shape) - shape (cond-> shape - (gmt/matrix? rz-modifier) (geom/transform rz-modifier) - (gmt/matrix? ds-modifier) (geom/transform ds-modifier)) - + (let [shape (geom/transform-shape shape) {:keys [id x y width height]} shape props (-> (attrs/extract-style-attrs shape) @@ -126,5 +120,7 @@ [:svg {:x x :y y :width width :height height} [:> "rect" props] (for [item childs] - [:& shape-wrapper {:frame shape :shape item :key (:id item)}])]))) + [:& shape-wrapper {:frame shape + :shape item + :key (:id item)}])])))