jonathanperret / paysage

Paysage is a visual shared playground for code.
http://paysage.xyz
GNU Affero General Public License v3.0
19 stars 9 forks source link

Wrong `width` and `height` during `setup()` #68

Closed jonathanperret closed 7 years ago

jonathanperret commented 7 years ago

Given a sketch like this:

float center;
void setup() {
  center = width / 2;
}
void draw() {
  rect(center - 5, 0, 10, 10);
}

One would expect something to appear at the center top of the canvas, but instead it happens somewhere in the top left. This is because width and height have their default value of 150 during the execution of setup(), and Paysage’s auto-sizing to the window only happens between setup() and draw().