From 4e1eb2d6e9e14393795b54d5fea59ce2393b3126 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 18 Jan 2023 16:31:45 +0100 Subject: [PATCH] :bug: Fix problem when flipping a mask --- .../app/main/data/workspace/transforms.cljs | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 6ff4cfa8c9..4539c490cf 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -750,36 +750,22 @@ (ptk/reify ::flip-horizontal-selected ptk/WatchEvent (watch [_ state _] - (let [objects (wsh/lookup-page-objects state) - selected (wsh/lookup-selected state {:omit-blocked? true}) - shapes (map #(get objects %) selected) - selrect (gsh/selection-rect shapes) - origin (gpt/point (:x selrect) (+ (:y selrect) (/ (:height selrect) 2))) - - modif-tree (dwm/create-modif-tree - selected - (-> (ctm/empty) - (ctm/resize (gpt/point -1.0 1.0) origin) - (ctm/move (gpt/point (:width selrect) 0))))] - - (rx/of (dwm/set-modifiers modif-tree true) - (dwm/apply-modifiers)))))) + (let [objects (wsh/lookup-page-objects state) + selected (wsh/lookup-selected state {:omit-blocked? true}) + shapes (map #(get objects %) selected) + selrect (gsh/selection-rect shapes) + center (gsh/center-selrect selrect) + modifiers (dwm/create-modif-tree selected (ctm/resize-modifiers (gpt/point -1.0 1.0) center))] + (rx/of (dwm/apply-modifiers {:modifiers modifiers})))))) (defn flip-vertical-selected [] (ptk/reify ::flip-vertical-selected ptk/WatchEvent (watch [_ state _] - (let [objects (wsh/lookup-page-objects state) - selected (wsh/lookup-selected state {:omit-blocked? true}) - shapes (map #(get objects %) selected) - selrect (gsh/selection-rect shapes) - origin (gpt/point (+ (:x selrect) (/ (:width selrect) 2)) (:y selrect)) - - modif-tree (dwm/create-modif-tree - selected - (-> (ctm/empty) - (ctm/resize (gpt/point 1.0 -1.0) origin) - (ctm/move (gpt/point 0 (:height selrect)))))] - - (rx/of (dwm/set-modifiers modif-tree true) - (dwm/apply-modifiers)))))) + (let [objects (wsh/lookup-page-objects state) + selected (wsh/lookup-selected state {:omit-blocked? true}) + shapes (map #(get objects %) selected) + selrect (gsh/selection-rect shapes) + center (gsh/center-selrect selrect) + modifiers (dwm/create-modif-tree selected (ctm/resize-modifiers (gpt/point 1.0 -1.0) center))] + (rx/of (dwm/apply-modifiers {:modifiers modifiers}))))))