语言

Menu
Sites
Language
Wrong screen scaling on a real device

Hello,

My Tizen application runs in 480x480 HTML5 Canvas. I set the width of the viewport to 480, so the game can run in "fullscreen" on any device by zooming its Canvas to the physical screen width (normally zoom in, as the screen resolution of the real devices is much higher than 480):

  <head>
    <title>MyApp</title>
    <meta name="viewport" content="width=480, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
  body
  {
    margin:0px;
    padding:0px;
  }
  canvas
  {
    outline:0;
    border:0px solid #333;
  }
  </style>
  </head>
  <body background="back.png">
  <canvas id="canvas">Your browser doesn't support canvas.</canvas>

then the JS code sets the canvas size:

    // Setup the canvas and the context (HTML 5)
    gCanvas = document.getElementById('canvas');
    gContext = gCanvas.getContext('2d');
    // Set the game field
    gCanvas.width = 480;
    gCanvas.height = 480;

 

Needless to say, on emulator it runs as expected - the whole game screen is 100% fit in the display width. But the application was rejected from Tizen store, as the screen doesn't fit in the screen of a real device (which means it was zoomed to several hundert percent)! What can be the problem?

响应

4 回复
Jordan Tuzsuzov

Just want to bump the question. Is there really no one who experience similar issue?

Marco Buettner

I use for all projects as argument for width "device-width"... the Viewport of Tizen WebView is 360px not 480px

AVSukhov

Hello,

The Tizen Web UI service template provides 2 scaling methods: device-width and fixed-width. To provide the best view for both methods, the Tizen Web UI widgets are implemented using the rem length unit, which is a relative value scaled by the base font size of the root element.

Jordan Tuzsuzov

Thank you for the answers.

Still - if you use fullscreen on a device with 1280x720 (like Samsung Z), the screen width is phisically 720 pixels. If I set viewport to 480, by the rendering it is expected to map the 480 to 720 and to scale the image with index 1.5x. At least this is how it works on the emulator and how it is expected to work following the specification. Why it is rendering the image with zooming (perhaps) 2x instead? Also, if the viewport is 360 (fixed), does this mean I can not render 1:1 pixel ratio and use the whole 720 pixel count width on the Z if I want?