The buttons that I’ve added to my sketch are not really positioned on my canvas. I think they’re actually floating. I need them to be in fixed spots on my canvas. How do I accomplish this?
I think my centerCanvas() function is the culprit but I need it. I need to keep the canvas centered on the screen.
function centerCanvas() {
var x = (windowWidth - width) / 2;
var y = (windowHeight - height) / 2;
cnv.position(x, y);
}
function windowResized() {
centerCanvas();
}
I couldn’t make the _renderer coordinates work but I found a solution to my problem. I adjust the positions of my buttons in the centerCanvas function now.
var x;
var y;
function centerCanvas() {
x = (windowWidth - width) / 2;
y = (windowHeight - height) / 2;
cnv.position(x, y);
button1.position(x + 220, y + 535);
button2.position(x + 706, y + 535);
}