I had an earlier problem where buttons didn’t stay where I wanted on the canvas. I managed to resolve that problem. I should say resolved somewhat because the position is slightly different in Chrome compared to Mozilla.
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);
}
function windowResized() {
centerCanvas();
}
Now the problem is that using the same technique as above (positioning elements based on x,y values calculated from code above), text appears in different positions in different browsers, on different computers. Also, the text also appears in different positions depending on whether the page was loaded while the browser was maximized or not.
text("Select image:", x - 220, y); //x,y values calculated in the code above
How do I go about reliably positioning text and buttons in my sketch?
Thanks.