q5xjs icon indicating copy to clipboard operation
q5xjs copied to clipboard

q5.pop() does not restore fill properties

Open awelles opened this issue 3 years ago • 1 comments

The following code will draw two ellipses every loop. Expected: The first ellipse filled, the second no fill. Got: Using q5 both ellipses will have no fill.
( With p5.js the expected behavior is shown )

It appears that q5.pop() doesn't restore a bunch of variables such as ._noFill, and ._noStroke. The context's .fillStyle is restored properly, but is then unused;

code:

q5 = new Q5(); q5.setup = function () { q5.createCanvas(q5.windowWidth, q5.windowHeight); q5.fill('#000000'); };

q5.draw = function () { q5.clear(); q5.ellipse(100, 100, 30, 30); q5.push(); q5.noFill(); q5.ellipse(200, 100, 30, 30); q5.pop(); };

It appears that q5.pop() doesn't restore a bunch of variables such as ._noFill, and ._noStroke. The context's .fillStyle is restored properly, but is then unused;

awelles avatar Jul 17 '21 06:07 awelles

I fixed this in my upgrade to q5js!

https://github.com/quinton-ashley/q5js

quinton-ashley avatar Feb 08 '23 13:02 quinton-ashley