Skip to content

Commit

Permalink
fix last_detected_blade_effect when used in MultiTransitionEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Feb 4, 2024
1 parent 8b63617 commit 1eaa79c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions style_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -5621,29 +5621,35 @@
this.effect_ = new OneshotEffectDetector(this.EFFECT);
this.TRANSITIONS=[];
this.running=[];
this.E=[];
this.pos = 0;
for (var i = 0; i < this.N; i++) {
this.TRANSITIONS.push(this.TRANSITION.DOCOPY());
this.running.push(false);
this.E.push(null);
}
HandleEffectType(EFFECT_ARG);
}
run(blade) {
var TMP = last_detected_blade_effect;
var e = this.effect_.Detect(blade);
if (e) {
this.TRANSITIONS[this.pos].begin();
this.running[this.pos] = true;
this.E[this.pos] = last_detected_blade_effect;
this.pos++;
if (this.pos == this.N) this.pos = 0;
}
for (var i = 0; i < this.N; i++) {
if (this.running[i]) {
last_detected_blade_effect = this.E[i];
this.TRANSITIONS[i].run(blade);
if (this.TRANSITIONS[i].done()) {
this.running[i] = false;
}
}
}
last_detected_blade_effect = last_detected_blade_effect;
}
getColor(led) {
var ret = Transparent();
Expand Down Expand Up @@ -6612,15 +6618,12 @@
this.c2p = -1;
}
updateC2P() {
console.log("POS = " + this.pos_);
for (var i = this.pos_ + 1; i < this.ARGS.length - 1; i++) {
if (this.ARGS[i].getType() != "TRANSITION") {
this.c2p = i;
console.log("C2P = " + i);
return;
}
}
console.log("C2P = -1");
this.c2p = -1;
}
begin() {
Expand Down

0 comments on commit 1eaa79c

Please sign in to comment.