0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 07:11:32 -05:00

🐛 Fix snap pixel when moving path points on high zoom

This commit is contained in:
alonso.torres 2023-03-10 13:06:11 +01:00
parent 481e9b0d32
commit 468e61e1e0
2 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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)))))))))