q5js / q5.js

A sequel to p5.js that's optimized for interactive art!
https://q5js.org
GNU Lesser General Public License v3.0
123 stars 9 forks source link

`erase` and `noErase` function implementation #33

Closed quinton-ashley closed 5 months ago

quinton-ashley commented 5 months ago

@Tezumie I'm a bit confused about what this code is doing:

if ($._fillSet) {
    $.ctx.fillStyle = $.color($.ctx.fillStyle).toString();
}
if ($._strokeSet) {
    $.ctx.strokeStyle = $.color($.ctx.strokeStyle).toString();
}

It seems like it would do nothing in cases where the fill and stroke styles can be parse by color. Do you mean to put back the original fill and stroke that the user had set before using erase ?

Tezumie commented 5 months ago

Good catch! its not necessary.

quinton-ashley commented 5 months ago

@Tezumie p5's noErase actually resets the original fill and stroke

https://p5js.org/reference/#/p5/noErase

quinton-ashley commented 5 months ago

fixed in v2.0-beta11