I'm getting started on javascript using the p5.js library and I noticed this: canvas NOT positioned in top left corner
When I create a canvas, it is at the origin in cartesian plane. But the origin is not at the top left corner of the window. Actually, the origin (0, 0) is at (8, 8) and the top left corner is at (-8, -8). (Maybe) You can see this "offset" running the snippet.
So how do I relocate the origin (0, 0) to the top left corner? or How do I relocate the created canvas to the top left corner?
(This happens in Chrome and in Edge, but works fine in Firefox. And I'm on Wwindows 10).
This didn't work: https://github.com/processing/p5.js/wiki/Positioning-your-canvas
function setup() {
var cnv = createCanvas(windowWidth, windowHeight);
background(0);
}
function draw() {
fill(0, 255, 0);
rect(0, 0, 30, 30);
console.log(mouseX, mouseY);
}
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
<script src="test.js"></script>
<title>index</title>
</head>
<body>
</body>
</html>