0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 00:28:20 -05:00

🐛 Fix problem when changing page while editing text

This commit is contained in:
alonso.torres 2022-03-17 16:27:07 +01:00
parent 444567faac
commit 928128ba2d

View file

@ -235,11 +235,12 @@
(defn translate-point-from-viewport (defn translate-point-from-viewport
"Translate a point in the viewport into client coordinates" "Translate a point in the viewport into client coordinates"
[pt viewport zoom] [pt viewport zoom]
(let [vbox (.. ^js viewport -viewBox -baseVal) (when (some? viewport)
box (gpt/point (.-x vbox) (.-y vbox)) (let [vbox (.. ^js viewport -viewBox -baseVal)
zoom (gpt/point zoom)] box (gpt/point (.-x vbox) (.-y vbox))
(-> (gpt/subtract pt box) zoom (gpt/point zoom)]
(gpt/multiply zoom)))) (-> (gpt/subtract pt box)
(gpt/multiply zoom)))))
(mf/defc text-editor-viewport (mf/defc text-editor-viewport
{::mf/wrap-props false} {::mf/wrap-props false}