From 8f77a59a97de2e58a9b75b5eaac94baec75403e8 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 20 Feb 2020 11:50:43 +0100 Subject: [PATCH] :sparkles: Improved canvas displacement on options. --- .../main/ui/workspace/sidebar/options/canvas.cljs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/options/canvas.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/options/canvas.cljs index 371bbab63..20a578d8f 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/canvas.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/canvas.cljs @@ -36,10 +36,15 @@ on-position-change (fn [event attr] - (let [value (-> (dom/get-target event) - (dom/get-value) - (d/parse-integer))] - (st/emit! (udw/update-position (:id shape) {attr value})))) + (let [cval (-> (dom/get-target event) + (dom/get-value) + (d/parse-integer)) + pval (get shape attr) + delta (if (= attr :x) + (gpt/point (math/neg (- pval cval)) 0) + (gpt/point 0 (math/neg (- pval cval))))] + (st/emit! (udw/apply-canvas-displacement (:id shape) delta) + (udw/materialize-canvas-displacement (:id shape))))) on-width-change #(on-size-change % :width) on-height-change #(on-size-change % :height)