Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

OSR incorrect MouseWheelEvent coordinates

Post Reply
Student
Posts: 72
Joined: Tue Aug 07, 2018 9:20 am

OSR incorrect MouseWheelEvent coordinates

Post 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;
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: OSR incorrect MouseWheelEvent coordinates

Post by salvadordf »

Thanks again for reporting issues! :D

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