From 8b2a64852b965b5e8fde97aa6f523ff64e061a96 Mon Sep 17 00:00:00 2001 From: llama <100429699+iamllama@users.noreply.github.com> Date: Sun, 13 Apr 2025 12:44:28 +0800 Subject: [PATCH] fix drag/drop breaking when editor is zoomed (#3916) --- qt/aqt/editor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 9627f5fc7..6736adc42 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1053,9 +1053,10 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too if ret: self.doPaste(html, internal, extended) - self.web.evalWithCallback( - f"focusIfField({cursor_pos.x()}, {cursor_pos.y()});", pasteIfField - ) + zoom = self.web.zoomFactor() + x, y = int(cursor_pos.x() / zoom), int(cursor_pos.y() / zoom) + + self.web.evalWithCallback(f"focusIfField({x}, {y});", pasteIfField) def onPaste(self) -> None: self.web.onPaste()