0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

Fix wrong behavior on canvas position translation.

The translation was not aware of bounding rect size
increment when shapes are out of main drawing zone.
This commit is contained in:
Andrey Antukh 2016-02-19 22:33:10 +02:00
parent e104386398
commit 6226c7f93b

View file

@ -188,9 +188,12 @@
(let [viewport (mx/get-ref-dom own "viewport")]
(when-let [canvas (dom/get-element-by-class "page-canvas" viewport)]
(let [brect (.getBoundingClientRect canvas)
bbox (.getBBox canvas)
brect (gpt/point (parse-int (.-left brect))
(parse-int (.-top brect)))]
(gpt/subtract pt brect)))))
(parse-int (.-top brect)))
bbox (gpt/point (.-x bbox) (.-y bbox))]
(-> (gpt/add pt bbox)
(gpt/subtract brect))))))
(on-key-down [event]
(when (kbd/space? event)