Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window resize events, viewport size and fullscreen mode #65

Open
cookiengineer opened this issue Apr 12, 2017 · 0 comments
Open

Window resize events, viewport size and fullscreen mode #65

cookiengineer opened this issue Apr 12, 2017 · 0 comments

Comments

@cookiengineer
Copy link
Contributor

cookiengineer commented Apr 12, 2017

Is there something like a window.onresize = function(){} available on the global object?

When looking at the bindings, I found something like sizeChanged(width, height) that seems to be called, but I couldn't find it somewhere else.

Other ways of resizing the window (setting innerWidth, innerHeight or calling setSize()) seem to fire no event or callback.

My questions are now as follows:

  • Is there a way to get the viewport size (like 1920x1080 when my window is smaller)?
  • If not, is there a way to get resize events of the window when the user maximizes it?
  • Fullscreen mode could be optional, if not wanted - but if so, dependencies would be the previous two points to implement it manually.

Use case could be as follows:

window.addEventListener('resize', function(width, height) {
    console.log('window was resized by user, need to resize my canvas nao');
});


let mybutton = new DummyFullscreenButton();

mybutton.bind('touch', function() {
    if (window.viewportWidth < window.innerWidth || window.viewportHeight < window.innerHeight) {
        window.setSize(window.viewportWidth, window.viewportHeight);
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant