Skip to content

Commit bea4d02

Browse files
committed
Make internal stroke and fill also enable stroke and fill
1 parent 0f44413 commit bea4d02

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/color/setting.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,6 @@ function setting(p5, fn){
12091209
* @chainable
12101210
*/
12111211
fn.fill = function(...args) {
1212-
this._renderer.states.fillSet = true;
1213-
this._renderer.states.doFill = true;
12141212
this._renderer.fill(...args);
12151213
return this;
12161214
};
@@ -1581,8 +1579,6 @@ function setting(p5, fn){
15811579
*/
15821580

15831581
fn.stroke = function(...args) {
1584-
this._renderer.states.strokeSet = true;
1585-
this._renderer.states.doStroke = true;
15861582
this._renderer.stroke(...args);
15871583
return this;
15881584
};

src/core/p5.Renderer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ class Renderer {
154154

155155
}
156156

157+
fill() {
158+
this.states.fillSet = true;
159+
this.states.doFill = true;
160+
}
161+
162+
stroke() {
163+
this.states.strokeSet = true;
164+
this.states.doStroke = true;
165+
}
166+
157167
textSize(s) {
158168
if (typeof s === 'number') {
159169
this.states.textSize = s;

src/core/p5.Renderer2D.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ class Renderer2D extends Renderer {
200200
}
201201

202202
fill(...args) {
203+
super.fill(...args);
203204
const color = this._pInst.color(...args);
204205
this._setFill(color.toString());
205206

@@ -210,6 +211,7 @@ class Renderer2D extends Renderer {
210211
}
211212

212213
stroke(...args) {
214+
super.stroke(...args);
213215
const color = this._pInst.color(...args);
214216
this._setStroke(color.toString());
215217

src/webgl/p5.RendererGL.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ class RendererGL extends Renderer {
697697
* black canvas with purple cube spinning
698698
*/
699699
fill(...args) {
700+
super.fill(...args);
700701
//see material.js for more info on color blending in webgl
701702
// const color = fn.color.apply(this._pInst, arguments);
702703
const color = this._pInst.color(...args);
@@ -736,6 +737,7 @@ class RendererGL extends Renderer {
736737
* black canvas with purple cube with pink outline spinning
737738
*/
738739
stroke(...args) {
740+
super.stroke(...args);
739741
// const color = fn.color.apply(this._pInst, arguments);
740742
const color = this._pInst.color(...args);
741743
this.states.curStrokeColor = color._array;

0 commit comments

Comments
 (0)