1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Fixed context menu position in FMX demos using OSR mode in high DPI screens

Fixed a build issue in the SubProcess demo.
This commit is contained in:
salvadordf
2022-06-25 18:19:14 +02:00
parent 7f3e3415ef
commit 676162a41b
9 changed files with 135 additions and 64 deletions

View File

@@ -588,10 +588,11 @@ procedure TFMXExternalPumpBrowserFrm.chrmosrGetScreenPoint( Sender : TObje
out Result : Boolean);
var
TempScreenPt, TempViewPt : TPoint;
TempScale : single;
begin
// TFMXBufferPanel.ClientToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
TempViewPt.x := viewX;
TempViewPt.y := viewY;
TempScale := Panel1.ScreenScale;
TempViewPt.x := LogicalToDevice(viewX, TempScale);
TempViewPt.y := LogicalToDevice(viewY, TempScale);
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
screenX := TempScreenPt.x;
screenY := TempScreenPt.y;

View File

@@ -578,8 +578,8 @@ procedure TMainForm.chrmosrGetScreenPoint( Sender : TObject;
var
TempPoint : TPointF;
begin
TempPoint.x := viewX;
TempPoint.y := viewY;
TempPoint.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor);
TempPoint.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor);
// LocalToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
TempPoint := Panel1.LocalToScreen(TempPoint);
screenX := round(TempPoint.x);

View File

@@ -213,6 +213,7 @@ begin
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
inherited Destroy;
end;
procedure TBrowserFrame.ReloadBtnClick(Sender: TObject);
begin
FMXChromium1.Reload;
@@ -222,6 +223,7 @@ procedure TBrowserFrame.FocusBrowser;
begin
FMXBufferPanel1.SetFocus;
end;
procedure TBrowserFrame.ResizeBrowser;
begin
try
@@ -244,6 +246,7 @@ begin
if (FResizeCS <> nil) then FResizeCS.Release;
end;
end;
procedure TBrowserFrame.NotifyMoveOrResizeStarted;
begin
FMXChromium1.NotifyMoveOrResizeStarted;
@@ -490,10 +493,11 @@ procedure TBrowserFrame.FMXChromium1GetScreenPoint(Sender: TObject;
screenY: Integer; out Result: Boolean);
var
TempScreenPt, TempViewPt : TPoint;
TempScale : single;
begin
// TFMXBufferPanel.ClientToScreen applies the scale factor. No need to call LogicalToDevice to set TempViewPt.
TempViewPt.x := viewX;
TempViewPt.y := viewY;
TempScale := FMXBufferPanel1.ScreenScale;
TempViewPt.x := LogicalToDevice(viewX, TempScale);
TempViewPt.y := LogicalToDevice(viewY, TempScale);
TempScreenPt := FMXBufferPanel1.ClientToScreen(TempViewPt);
screenX := TempScreenPt.x;
screenY := TempScreenPt.y;