0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

🐛 Fix viewer comment position when zoom applied

This commit is contained in:
alonso.torres 2021-11-08 16:11:05 +01:00 committed by Andrés Moya
parent f50943d470
commit aa276ab308
2 changed files with 5 additions and 3 deletions

View file

@ -23,6 +23,7 @@
- Add shortcuts to boolean icons popups [Taiga #2220](https://tree.taiga.io/project/penpot/issue/2220) - Add shortcuts to boolean icons popups [Taiga #2220](https://tree.taiga.io/project/penpot/issue/2220)
- Fix a worker error when transforming a rectangle into path - Fix a worker error when transforming a rectangle into path
- Fix max/min values for opacity fields [Taiga #2183](https://tree.taiga.io/project/penpot/issue/2183) - Fix max/min values for opacity fields [Taiga #2183](https://tree.taiga.io/project/penpot/issue/2183)
- Fix viewer comment position when zoom applied [Taiga #2240](https://tree.taiga.io/project/penpot/issue/2240)
### :arrow_up: Deps updates ### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -105,14 +105,15 @@
on-click on-click
(mf/use-callback (mf/use-callback
(mf/deps cstate frame page file) (mf/deps cstate frame page file zoom)
(fn [event] (fn [event]
(dom/stop-propagation event) (dom/stop-propagation event)
(if (some? (:open cstate)) (if (some? (:open cstate))
(st/emit! (dcm/close-thread)) (st/emit! (dcm/close-thread))
(let [event (.-nativeEvent ^js event) (let [event (.-nativeEvent ^js event)
position (-> (dom/get-offset-position event) viewport-point (dom/get-offset-position event)
(gpt/transform modifier2)) viewport-point (-> viewport-point (update :x #(/ % zoom)) (update :y #(/ % zoom)))
position (gpt/transform viewport-point modifier2)
params {:position position params {:position position
:page-id (:id page) :page-id (:id page)
:file-id (:id file)}] :file-id (:id file)}]