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
Background does not redraw properly on resized canvases #45
Comments
Can you provide a test case? Because when I tested this now, it works as it should. |
Are you resizing using the properties in oCanvas (core.width, core.height), or via some other way in the DOM? You need to resize via the properties in oCanvas, since there is no way of detecting when an element has been resized, except for polling all the time, which isn't really a good solution. |
Oh I see. I was using a window resize event listener, and I was just resizing the canvas element instead of the oCanvas properties. Thanks! |
And just to be more clear about these properties: They do not only resize, but also redraw, so you don't have to make an extra call to redraw :) |
I know this issue is closed but I wanted to know if there was a way to overload the default redrawing? My issue is when I resize the browser window I want to resize the canvas to fill the |
I'd say that it would be expected and the best experience if it was redrawn on every resize, since you would otherwise see empty areas in the canvas before the redraw kicks in. Is the problem that you don't throttle the resize handler (the resize event can be triggered multiple times per frame)? Or is one redraw per frame too much? In that case, maybe you could try to throttle the resize handler to every 100 ms (or what time you feel is good for your project)? |
If I resize my canvas after initializing the Core module, and then call
redraw()
on either the Core module or the Draw module, the background doesn't redraw to fill the canvas. Callingreset()
on the Core module doesn't work either, nor does using theset()
method on the Background module. If I were to guess, I think it's due to the drawing function not checking for canvas size changes after the initialization.The text was updated successfully, but these errors were encountered: