refactor: oppt
This commit is contained in:
parent
779ade1058
commit
41c2c0950e
|
@ -7,6 +7,8 @@ export default () => class Primitive extends Trait {
|
|||
|
||||
#primitives;
|
||||
|
||||
#scheduledDraw = true;
|
||||
|
||||
static defaultParams() {
|
||||
return {
|
||||
primitives: [],
|
||||
|
@ -68,22 +70,29 @@ export default () => class Primitive extends Trait {
|
|||
return {
|
||||
|
||||
blueChanged: () => {
|
||||
this.drawPrimitives();
|
||||
this.#scheduledDraw = true;
|
||||
},
|
||||
|
||||
greenChanged: () => {
|
||||
this.drawPrimitives();
|
||||
this.#scheduledDraw = true;
|
||||
},
|
||||
|
||||
redChanged: () => {
|
||||
this.drawPrimitives();
|
||||
this.#scheduledDraw = true;
|
||||
},
|
||||
|
||||
traitAdded: () => {
|
||||
this.drawPrimitives();
|
||||
this.#scheduledDraw = true;
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
renderTick() {
|
||||
if (this.#scheduledDraw) {
|
||||
this.#scheduledDraw = false;
|
||||
this.drawPrimitives();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user