Created
June 28, 2019 17:44
-
-
Save GoToLoop/54b4c49e9c2541da2d91692bf0c01192 to your computer and use it in GitHub Desktop.
windowResized()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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