Skip to content

Commit 2e7cf1a

Browse files
authored
Merge pull request #7672 from processing/fix/debugMode
Fix debug mode for 2.0
2 parents ddb64d6 + dd5efa2 commit 2e7cf1a

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/webgl/interaction.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -691,34 +691,30 @@ function interaction(p5, fn){
691691
// p5._validateParameters('debugMode', args);
692692

693693
// start by removing existing 'post' registered debug methods
694-
for (let i = this._registeredMethods.post.length - 1; i >= 0; i--) {
694+
for (let i = p5.lifecycleHooks.postdraw.length - 1; i >= 0; i--) {
695695
// test for equality...
696696
if (
697-
this._registeredMethods.post[i].toString() === this._grid().toString() ||
698-
this._registeredMethods.post[i].toString() === this._axesIcon().toString()
697+
p5.lifecycleHooks.postdraw[i].toString() === this._grid().toString() ||
698+
p5.lifecycleHooks.postdraw[i].toString() === this._axesIcon().toString()
699699
) {
700-
this._registeredMethods.post.splice(i, 1);
700+
p5.lifecycleHooks.postdraw.splice(i, 1);
701701
}
702702
}
703703

704704
// then add new debugMode functions according to the argument list
705705
if (args[0] === constants.GRID) {
706-
this.registerMethod(
707-
'post',
706+
p5.lifecycleHooks.postdraw.push(
708707
this._grid(args[1], args[2], args[3], args[4], args[5])
709708
);
710709
} else if (args[0] === constants.AXES) {
711-
this.registerMethod(
712-
'post',
710+
p5.lifecycleHooks.postdraw.push(
713711
this._axesIcon(args[1], args[2], args[3], args[4])
714712
);
715713
} else {
716-
this.registerMethod(
717-
'post',
714+
p5.lifecycleHooks.postdraw.push(
718715
this._grid(args[0], args[1], args[2], args[3], args[4])
719716
);
720-
this.registerMethod(
721-
'post',
717+
p5.lifecycleHooks.postdraw.push(
722718
this._axesIcon(args[5], args[6], args[7], args[8])
723719
);
724720
}
@@ -766,13 +762,13 @@ function interaction(p5, fn){
766762
this._assert3d('noDebugMode');
767763

768764
// start by removing existing 'post' registered debug methods
769-
for (let i = this._registeredMethods.post.length - 1; i >= 0; i--) {
765+
for (let i = p5.lifecycleHooks.postdraw.length - 1; i >= 0; i--) {
770766
// test for equality...
771767
if (
772-
this._registeredMethods.post[i].toString() === this._grid().toString() ||
773-
this._registeredMethods.post[i].toString() === this._axesIcon().toString()
768+
p5.lifecycleHooks.postdraw[i].toString() === this._grid().toString() ||
769+
p5.lifecycleHooks.postdraw[i].toString() === this._axesIcon().toString()
774770
) {
775-
this._registeredMethods.post.splice(i, 1);
771+
p5.lifecycleHooks.postdraw.splice(i, 1);
776772
}
777773
}
778774
};
@@ -861,9 +857,9 @@ function interaction(p5, fn){
861857
zOff = xOff;
862858
}
863859

864-
return function() {
860+
return () => {
865861
this.push();
866-
this._renderer.states.setValue('uModelMatrix', this.states.uModelMatrix.clone());
862+
this._renderer.states.setValue('uModelMatrix', this._renderer.states.uModelMatrix.clone());
867863
this._renderer.states.uModelMatrix.reset();
868864

869865
// X axis

0 commit comments

Comments
 (0)