diff --git a/src/uxbox/ui/workspace/base.cljs b/src/uxbox/ui/workspace/base.cljs index bed48a2fcb..cc383503b1 100644 --- a/src/uxbox/ui/workspace/base.cljs +++ b/src/uxbox/ui/workspace/base.cljs @@ -119,6 +119,7 @@ (defonce mouse-delta-s (->> mouse-viewport-s (rx/sample 10) + (rx/map #(gpt/divide % @zoom-l)) (rx/mapcat (fn [point] (if @alignment-l (uds/align-point point) diff --git a/src/uxbox/ui/workspace/movement.cljs b/src/uxbox/ui/workspace/movement.cljs index 9f3249a394..0537ed7891 100644 --- a/src/uxbox/ui/workspace/movement.cljs +++ b/src/uxbox/ui/workspace/movement.cljs @@ -37,8 +37,7 @@ (rx/filter empty?) (rx/take 1)) stream (->> wb/mouse-delta-s - (rx/take-until stoper) - (rx/map #(gpt/divide % @wb/zoom-l)))] + (rx/take-until stoper))] (when @wb/alignment-l (rs/emit! (uds/initial-align-shape shape))) (rx/subscribe stream #(rs/emit! (uds/move-shape shape %))))) diff --git a/src/uxbox/ui/workspace/resize.cljs b/src/uxbox/ui/workspace/resize.cljs index 2bc353afdc..8520995c36 100644 --- a/src/uxbox/ui/workspace/resize.cljs +++ b/src/uxbox/ui/workspace/resize.cljs @@ -37,7 +37,6 @@ (rx/take 1)) stream (->> wb/mouse-delta-s (rx/take-until stoper) - (rx/map #(gpt/divide % @wb/zoom-l)) (rx/with-latest-from vector wb/mouse-ctrl-s))] (when @wb/alignment-l (rs/emit! (uds/initial-vertext-align shape vid))) diff --git a/src/uxbox/util/geom.cljs b/src/uxbox/util/geom.cljs index e30ed33e04..42ec854d83 100644 --- a/src/uxbox/util/geom.cljs +++ b/src/uxbox/util/geom.cljs @@ -49,26 +49,26 @@ for rect-like shapes." [shape {dx :x dy :y}] (assoc shape - :x1 (+ (:x1 shape) dx) - :y1 (+ (:y1 shape) dy) - :x2 (+ (:x2 shape) dx) - :y2 (+ (:y2 shape) dy))) + :x1 (mth/round (+ (:x1 shape) dx)) + :y1 (mth/round (+ (:y1 shape) dy)) + :x2 (mth/round (+ (:x2 shape) dx)) + :y2 (mth/round (+ (:y2 shape) dy)))) (defn- move-circle "A specialized function for relative movement for circle shapes." [shape {dx :x dy :y}] (assoc shape - :cx (+ (:cx shape) dx) - :cy (+ (:cy shape) dy))) + :cx (mth/round (+ (:cx shape) dx)) + :cy (mth/round (+ (:cy shape) dy)))) (defn- move-group "A specialized function for relative movement for group shapes." [shape {dx :x dy :y}] (assoc shape - :dx (+ (:dx shape 0) dx) - :dy (+ (:dy shape 0) dy))) + :dx (mth/round (+ (:dx shape 0) dx)) + :dy (mth/round (+ (:dy shape 0) dy)))) ;; --- Absolute Movement