OSR incorrect MouseWheelEvent coordinates
Posted: Wed Jan 27, 2021 9:44 pm
Hi Salvador! I found another bug in TChromiumCore.SendMouseWheelEvent, it is not possible to fix the problem locally, because in module uCEFChromiumCore.pas
Sends scrolling by screen coordinates, if the application is open in full screen, you do not notice this problem, but it is necessary to change the position of the window and scrolling on the page begins to work crookedly. A demonstration of the problem is below.
To solve the problem, need convert the screen coordinates to the client. But I think this problem comes from the cef3 libraries.
Code: Select all
procedure TChromiumCore.SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer);
begin
if Initialized then
Browser.Host.SendMouseWheelEvent(event, deltaX, deltaY);
end;
To solve the problem, need convert the screen coordinates to the client. But I think this problem comes from the cef3 libraries.
Code: Select all
procedure TChromiumCore.SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer);
var MousePos: TPoint;
begin
if Initialized then
begin
mousepos.X:=event.x;
mousepos.Y:=event.y;
if screentoclient(browser.Host.WindowHandle,MousePos) then
begin
event.x:=mousepos.X;
event.y:=mousepos.Y;
end;
Browser.Host.SendMouseWheelEvent(event, deltaX, deltaY);
end;
end;