From 8b390d56fd1ed6dbe109f0bf627b6165ed094316 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 15 Dec 2022 16:21:24 -0300 Subject: [PATCH] [lua] Fix mouse position to client coordinates on mouse events --- src/app/script/dialog_class.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index 74aa7c5c6..ecfe3d249 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -927,10 +927,10 @@ int Dialog_canvas(lua_State* L) auto mouseCallback = [](lua_State* L, ui::MouseMessage* msg) { - lua_pushinteger(L, msg->position().x); + lua_pushinteger(L, msg->position().x - msg->recipient()->bounds().x); lua_setfield(L, -2, "x"); - lua_pushinteger(L, msg->position().y); + lua_pushinteger(L, msg->position().y - msg->recipient()->bounds().y); lua_setfield(L, -2, "y"); lua_pushinteger(L, int(msg->button()));