Jump to content

Mobile HTMLFrame Canvas Sizing Issue


andyhill

Recommended Posts

I have a Mobile

TMainmForm
  TUnimContainerPanel
    TUnimPanel
      TUnimHTMLFrame

All perfectly displayed on iOS Device.

I want to work with the HTMLFrame canvas which is declared in HTML as

  //HTMLFrame.HTML.Add('    <canvas id = "andy" width = "'+IntToStr(ContainerPanel.Width+43)+'" height = "'+IntToStr(ContainerPanel.Height+84)+'" style = "border: 1px solid #000000;">');
  HTMLFrame.HTML.Add('    <canvas id = "andy" width = "'+IntToStr(Panel.Width+43)+'" height = "'+IntToStr(Panel.Height+84)+'" style = "border: 1px solid #000000;">');
  //HTMLFrame.HTML.Add('    <canvas id = "andy" width = "100%" height = "100%" style = "border: 1px solid #000000;">');
  //HTMLFrame.HTML.Add('    <canvas id = "andy" width = "'+IntToStr(UniApplication.ScreenWidth-2)+'" height = "'+IntToStr(UniApplication.ScreenHeight-2)+'" style = "border: 1px solid #000000;">');

Why can I not get correct width/height for canvas, my best fit was Panel.Width+43 and Panel.Height+84 which is unique to my iPhoneX and incorrect for any other mobile device.

How can I get correct pixel dimensions to declare for my canvas ?

Please advise - thanks in advance.

CanvasPanelWidthHeight.PNG

Canvas100PercentWidthHeight.PNG

CanvasUniApplicationScreenWidthHeight.PNG

Link to comment
Share on other sites

×
×
  • Create New...