1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-22 22:17:48 +02:00

Fixed incorrect coordinates using the wheel button in OSR demos for Windows (VCL).

This commit is contained in:
Salvador Diaz Fau
2021-01-29 18:27:10 +01:00
parent e3fdfe8a45
commit cd46aa097d
11 changed files with 126 additions and 56 deletions

View File

@ -263,6 +263,7 @@ procedure TForm1.AppEventsMessage(var Msg: tagMSG; var Handled: Boolean);
var
TempKeyEvent : TCefKeyEvent;
TempMouseEvent : TCefMouseEvent;
TempPoint : TPoint;
begin
case Msg.message of
WM_SYSCHAR :
@ -366,11 +367,18 @@ begin
WM_MOUSEWHEEL :
if Panel1.Focused then
begin
TempMouseEvent.x := Msg.lParam and $FFFF;
TempMouseEvent.y := Msg.lParam shr 16;
GetCursorPos(TempPoint);
TempPoint := Panel1.ScreenToclient(TempPoint);
TempMouseEvent.x := TempPoint.x;
TempMouseEvent.y := TempPoint.y;
TempMouseEvent.modifiers := GetCefMouseModifiers(Msg.wParam);
DeviceToLogical(TempMouseEvent, Panel1.ScreenScale);
chrmosr.SendMouseWheelEvent(@TempMouseEvent, 0, smallint(Msg.wParam shr 16));
if CefIsKeyDown(VK_SHIFT) then
chrmosr.SendMouseWheelEvent(@TempMouseEvent, smallint(Msg.wParam shr 16), 0)
else
chrmosr.SendMouseWheelEvent(@TempMouseEvent, 0, smallint(Msg.wParam shr 16));
end;
end;
end;