Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
windowResized()
function windowResized() {
const css = getComputedStyle(canvas.parentElement),
mw = float(css.marginLeft) + float(css.marginRight),
mh = float(css.marginTop) + float(css.marginBottom),
ww = float(css.width) || windowWidth,
wh = float(css.height) || windowHeight,
w = round(ww - mw), h = round(wh - mh);
resizeCanvas(w, h, true);
}
p.windowResized = function () {
const css = getComputedStyle(this.canvas.parentElement),
mw = this.float(css.marginLeft) + this.float(css.marginRight),
mh = this.float(css.marginTop) + this.float(css.marginBottom),
ww = this.float(css.width) || this.windowWidth,
wh = this.float(css.height) || this.windowHeight,
w = this.round(ww - mw), h = this.round(wh - mh);
this.resizeCanvas(w, h, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment