1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-12-03 21:44:45 +02:00

Added touch and pen support to SimpleOSRBrowser and KioskOSRBrowser demos

- Added TBufferPanel.OnCustomTouch
- Added TBufferPanel.OnPointerDown
- Added TBufferPanel.OnPointerUp
- Added TBufferPanel.OnPointerUpdate
- Added TFMXWindowParent.Touch
- Added TFMXWindowParent.OnGesture
- Removed the gesture manager from the KioskOSRBrowser demo
This commit is contained in:
Salvador Díaz Fau
2020-02-03 12:02:30 +01:00
parent f324118a56
commit 1ca9ebf179
9 changed files with 621 additions and 51 deletions

View File

@@ -260,10 +260,13 @@ procedure DragOperationToDropEffect(const aDragOperations : TCefDragOperations;
function GetWindowsMajorMinorVersion(var wMajorVersion, wMinorVersion : DWORD) : boolean;
function GetDefaultCEFUserAgent : string;
function TouchPointToPoint(aHandle : HWND; const TouchPoint: TTouchInput): TPoint;
{$ENDIF}
function DeviceToLogical(aValue : integer; const aDeviceScaleFactor : double) : integer; overload;
function DeviceToLogical(aValue : single; const aDeviceScaleFactor : double) : single; overload;
procedure DeviceToLogical(var aEvent : TCEFMouseEvent; const aDeviceScaleFactor : double); overload;
procedure DeviceToLogical(var aEvent : TCefTouchEvent; const aDeviceScaleFactor : double); overload;
procedure DeviceToLogical(var aPoint : TPoint; const aDeviceScaleFactor : double); overload;
function LogicalToDevice(aValue : integer; const aDeviceScaleFactor : double) : integer; overload;
procedure LogicalToDevice(var aRect : TCEFRect; const aDeviceScaleFactor : double); overload;
@@ -283,6 +286,7 @@ function CefGetDataURI(aData : pointer; aSize : integer; const aMimeType : ustri
implementation
uses
System.Types,
uCEFApplicationCore, uCEFSchemeHandlerFactory, uCEFValue,
uCEFBinaryValue, uCEFStringList;
@@ -2081,6 +2085,12 @@ begin
'AppleWebKit/537.36 (KHTML, like Gecko) ' +
'Chrome/' + TempChromiumVersion + ' Safari/537.36';
end;
function TouchPointToPoint(aHandle : HWND; const TouchPoint: TTouchInput): TPoint;
begin
Result := Point(TouchPoint.X div 100, TouchPoint.Y div 100);
PhysicalToLogicalPoint(aHandle, Result);
end;
{$ENDIF}
function DeviceToLogical(aValue : integer; const aDeviceScaleFactor : double) : integer;
@@ -2088,12 +2098,23 @@ begin
Result := floor(aValue / aDeviceScaleFactor);
end;
function DeviceToLogical(aValue : single; const aDeviceScaleFactor : double) : single;
begin
Result := aValue / aDeviceScaleFactor;
end;
procedure DeviceToLogical(var aEvent : TCEFMouseEvent; const aDeviceScaleFactor : double);
begin
aEvent.x := DeviceToLogical(aEvent.x, aDeviceScaleFactor);
aEvent.y := DeviceToLogical(aEvent.y, aDeviceScaleFactor);
end;
procedure DeviceToLogical(var aEvent : TCefTouchEvent; const aDeviceScaleFactor : double);
begin
aEvent.x := DeviceToLogical(aEvent.x, aDeviceScaleFactor);
aEvent.y := DeviceToLogical(aEvent.y, aDeviceScaleFactor);
end;
procedure DeviceToLogical(var aPoint : TPoint; const aDeviceScaleFactor : double);
begin
aPoint.x := DeviceToLogical(aPoint.x, aDeviceScaleFactor);