Skip to content

Commit 7e0c043

Browse files
committed
Add constrain to address issue #175
1 parent b963f16 commit 7e0c043

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

01_P/P_1_2_1_01/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function setup() {
4949
}
5050

5151
function draw() {
52-
tileCountX = int(map(mouseX, 0, width, 2, 100));
53-
tileCountY = int(map(mouseY, 0, height, 2, 10));
52+
tileCountX = int(map(constrain(mouseX, 0, width), 0, width, 2, 100));
53+
tileCountY = int(map(constrain(mouseY, 0, height), 0, height, 2, 10));
5454
var tileWidth = width / tileCountX;
5555
var tileHeight = height / tileCountY;
5656
var interCol;

0 commit comments

Comments
 (0)