Page 1 of 1

OSR incorrect MouseWheelEvent coordinates

Posted: Wed Jan 27, 2021 9:44 pm
by Student
Hi Salvador! I found another bug in TChromiumCore.SendMouseWheelEvent, it is not possible to fix the problem locally, because in module uCEFChromiumCore.pas

Code: Select all

procedure TChromiumCore.SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer);
begin
  if Initialized then
   Browser.Host.SendMouseWheelEvent(event, deltaX, deltaY);
end;
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.

Image

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;

Re: OSR incorrect MouseWheelEvent coordinates

Posted: Fri Jan 29, 2021 5:28 pm
by salvadordf
Thanks again for reporting issues! :D

Please, download CEF4Delphi again from GitHub. I just fixed the OSR demos in VCL.