diff --git a/CHANGES.md b/CHANGES.md index dae12bee0..1a970b0f6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,7 @@ - Viewer wrong translations [Github #3035](https://github.com/penpot/penpot/issues/3035) - Fix problem with text editor in Safari - Fix unlink library color when blur color picker input [#3026](https://github.com/penpot/penpot/issues/3026) +- Fix snap pixel when moving path points on high zoom [#2930](https://github.com/penpot/penpot/issues/2930) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/workspace/path/edition.cljs b/frontend/src/app/main/data/workspace/path/edition.cljs index 318f1dbf3..7ba97c4df 100644 --- a/frontend/src/app/main/data/workspace/path/edition.cljs +++ b/frontend/src/app/main/data/workspace/path/edition.cljs @@ -153,6 +153,8 @@ selected-points (dm/get-in state [:workspace-local :edit-path id :selected-points] #{}) + start-position (apply min #(gpt/distance start-position %) selected-points) + content (st/get-path state :content) points (upg/content->points content)] @@ -241,7 +243,7 @@ (let [id (dm/get-in state [:workspace-local :edition]) cx (d/prefix-keyword prefix :x) cy (d/prefix-keyword prefix :y) - start-point @ms/mouse-position + modifiers (dm/get-in state [:workspace-local :edit-path id :content-modifiers]) start-delta-x (dm/get-in modifiers [index cx] 0) start-delta-y (dm/get-in modifiers [index cy] 0) @@ -258,7 +260,7 @@ (streams/drag-stream (rx/concat (rx/of (dch/update-shapes [id] upsp/convert-to-path)) - (->> (streams/move-handler-stream start-point point handler opposite points) + (->> (streams/move-handler-stream handler point handler opposite points) (rx/take-until (->> stream (rx/filter #(or (ms/mouse-up? %) (streams/finish-edition? %))))) (rx/map @@ -269,8 +271,8 @@ id index prefix - (+ start-delta-x (- (:x pos) (:x start-point))) - (+ start-delta-y (- (:y pos) (:y start-point))) + (+ start-delta-x (- (:x pos) (:x handler))) + (+ start-delta-y (- (:y pos) (:y handler))) (not alt?)))))) (rx/concat (rx/of (apply-content-modifiers)))))))))