re-render on window resize

This commit is contained in:
lee2sman 2021-02-07 03:24:46 -05:00
parent 5e5e29d717
commit 1d10139d3a
1 changed files with 5 additions and 3 deletions

View File

@ -28,9 +28,10 @@ function setpos(_newX, _newY, startx = x, starty = y) {
y = newY;
try {
if ((_newX == "") || (_newY == "")) throw "is missing input x,y coordinates";
if (isNaN(_newX) || (isNaN(_newY))) throw "requires: x,y input coordinates";
if ((_newX < 0) || (_newY < 0) || (_newX > windowWidth) || (_newY > windowHeight)) throw "drawing offscreen";
if (_newX == "" || _newY == "") throw "is missing input x,y coordinates";
if (isNaN(_newX) || isNaN(_newY)) throw "requires: x,y input coordinates";
if (_newX < 0 || _newY < 0 || _newX > windowWidth || _newY > windowHeight)
throw "drawing offscreen";
} catch (err) {
console.log("Error: setpos " + err);
}
@ -92,4 +93,5 @@ function displayTurtle() {
function windowResized() {
//resizes canvas if window is resized
resizeCanvas(windowWidth, windowHeight);
turtle(); //rerender
}