diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index c62fa658d..2ba9d0ec3 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -859,12 +859,6 @@ (rx/of (reorder-selected-layout-child direction)) (rx/of (nudge-selected-shapes direction shift?))))))) -(defn- get-delta [position bbox] - (let [cpos (gpt/point (:x bbox) (:y bbox)) - pos (gpt/point (or (:x position) (:x bbox)) - (or (:y position) (:y bbox)))] - (gpt/subtract pos cpos))) - (defn- get-relative-delta [position bbox parent] (let [parent-bbox (-> parent :points grc/points->rect) relative-cpos (gpt/subtract (gpt/point (:x bbox) (:y bbox)) @@ -888,10 +882,8 @@ shape (get objects id) ;; FIXME: performance rect bbox (-> shape :points grc/points->rect) - parent (cfh/get-parent objects id) - delta (if-not (:relative? options) - (get-delta position bbox) - (get-relative-delta position bbox parent)) + frame (cfh/get-frame objects shape) + delta (get-relative-delta position bbox frame) modif-tree (dwm/create-modif-tree [id] (ctm/move-modifiers delta))] (rx/of (dwm/apply-modifiers {:modifiers modif-tree :page-id page-id diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 1c11e6632..4642633f1 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -239,9 +239,8 @@ do-position-change (mf/use-fn (mf/deps ids) - (fn [shape' frame' value attr] - (let [to (+ value (attr frame'))] - (st/emit! (udw/update-position (:id shape') {attr to}))))) + (fn [shape' value attr] + (st/emit! (udw/update-position (:id shape') {attr value})))) on-position-change (mf/use-fn @@ -249,7 +248,7 @@ (fn [value attr] (st/emit! (udw/trigger-bounding-box-cloaking ids)) (binding [cts/*wasm-sync* true] - (doall (map #(do-position-change %1 %2 value attr) shapes frames))))) + (doall (map #(do-position-change %1 value attr) shapes))))) ;; ROTATION diff --git a/frontend/src/app/main/ui/workspace/tokens/changes.cljs b/frontend/src/app/main/ui/workspace/tokens/changes.cljs index 87fc449af..2d4a949e5 100644 --- a/frontend/src/app/main/ui/workspace/tokens/changes.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/changes.cljs @@ -290,12 +290,6 @@ {:ignore-touched true :page-id page-id})))))))) -(defn- immediate-flex-absolute-child? [objects id] - (let [shape (get objects id)] - (boolean - (and (:layout-item-absolute shape) - (ctsl/flex-layout-immediate-child? objects shape))))) - (defn update-shape-position ([value shape-ids attributes] (update-shape-position value shape-ids attributes nil)) ([value shape-ids attributes page-id] @@ -303,21 +297,12 @@ ptk/WatchEvent (watch [_ state _] (when (number? value) - (let [page-id' (or page-id (get state :current-page-id)) - objects (dsh/lookup-page-objects state page-id') - {canvas-children-ids false - flex-children-ids true} (group-by #(immediate-flex-absolute-child? objects %) shape-ids)] + (let [page-id' (or page-id (get state :current-page-id))] (rx/concat - (concat - (map #(dwt/update-position % (zipmap attributes (repeat value)) - {:ignore-touched true - :page-id page-id'}) - canvas-children-ids) - (map #(dwt/update-position % (zipmap attributes (repeat value)) - {:ignore-touched true - :page-id page-id' - :relative? true}) - flex-children-ids))))))))) + (map #(dwt/update-position % (zipmap attributes (repeat value)) + {:ignore-touched true + :page-id page-id'}) + shape-ids)))))))) (defn update-layout-sizing-limits