My current understanding with respect to this is that the fullscreen API is
lacking a strict specification that would dictate how scaling and aspect
ratio should handled when transitioning to full screen. If the element size
is 400x400 and the screen is 1280x800, then I can think of four different
ways at least:
   - Keep the element unchanged in size, i.e. have its size retained at
400x400 and center it on the screen, giving (black) empty area around all
sizes. I think Chrome currently does this.
   - Resize the element to full screen ignoring aspect ratio, i.e. the
400x400 element would be resized to 1280x800. I think Firefox currently
does this. (Although I'm writing this from previous memory, so might be
off).
   - Resize the element to fullscreen, retaining aspect ratio, which would
make the 400x400 element the size of 800x800, and adding black letterboxes
to left and right side.
   - Resize the element to fullscreen, retaining aspect ratio and
oversizing. This would make the 400x400 element the size 1280x1280, meaning
the top and bottom sides clip off, but no black is present on the screen.
This is perhaps very rare that user would want this, but e.g. current TVs
seem to do this with their different aspect ratio management when adapting
4:3 vs 16:9 and so on, so perhaps some applications might be interested in
it.

Also, the amount of options above is multiplied by twice, depending on
whether user wants to only adjust the CSS scale, or also the WebGL
rendering target size.

However from your numbers, it doesn't seem that any of these options would
have been used.

One option to resolve this would be to solve it via education/documentation
and say that "the element size is undefined after transitioning to
fullscreen. Please use emscripten_set_canvas_size() or similar to
explicitly resize the canvas after transitioning to fullscreen mode."

Another option would be to offer some kind of palette of behaviors (like
enumerated above) and allow the user to choose from them with some kind of
api.

There might be some resizing behavior that emscripten currently does,
perhaps there's a bug with that. I think the user should be easily able to
choose from any convention above. Please do write up a ticket and let's
continue this discussion in detail there. We should improve this, if
nothing else, then at least in API documentation, so that not every
developer needs to rediscover this behavior independently.


2014-07-20 18:19 GMT+03:00 Floh <[email protected]>:

> Hi,
>
> I'm seeing strange values for elementWidth and elementHeight when using
> the emscripten_set_fullscreenchange_callback() mechanism, which also
> differs between Chrome and Firefox (I'm testing on OSX10.10)
>
> On Chrome, when the fullscreenchange callback is called, the
> elementWidth/Height is actually the previous size before the switch (here's
> my own debug output when the callback is called, ew/eh is
> elementWidth/height, sw/sh is screen width/height, also the
> elementWidth/Height never matches the actual screen size.
>
> The canvas size before the fullscreen switch is 400x400.
>
> Chrome (press fullscreen button on standard emscripten HTML shell, and in
> fullscreen mode, press Esc to switch back):
> emscFullscreenChanged: isFullscreen=yes, fullscreenEnabled=yes, ew=400,
> eh=400, sw=1280, sh=800
> emscFullscreenChanged: isFullscreen=no, fullscreenEnabled=yes, ew=1263,
> eh=800, sw=1280, sh=800
>
> In Firefox it's completely different again: When switching into
> fullscreen, the width is the expected width (1280), but the height is
> different (721 vs the expected 800), and when switching back the new value
> is completely strange (1040x800).
>
> Firefox (current Nightly):
> emscFullscreenChanged: isFullscreen=yes, fullscreenEnabled=yes, ew=1280,
> eh=721, sw=1280, sh=800
> emscFullscreenChanged: isFullscreen=no, fullscreenEnabled=yes, ew=1040,
> eh=800, sw=1280, sh=800
>
> Anyone know what's up with that? Whould I write a ticket? For now I can
> workaround that by using the screen size, and restoring the previous
> 'windowed size' when switching back from fullscreen.
>
> Cheers,
> -Floh.
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to