Skip to content

Commit 8b260bb

Browse files
authored
Merge pull request #6491 from Somnath-Mishra/main
Throwing friendly error in webgl mode when using gridOutput() and textOutput()
2 parents 89e5bf1 + 5f30455 commit 8b260bb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/accessibility/gridOutput.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import p5 from '../core/main';
1010

1111
//updates gridOutput
1212
p5.prototype._updateGridOutput = function(idT) {
13+
// Check if the current rendering mode is WEBGL
14+
if (this._renderer && this._renderer instanceof p5.RendererGL) {
15+
if (!this._didOutputGridWebGLMessage) {
16+
this._didOutputGridWebGLMessage = true;
17+
console.error('gridOutput() does not yet work in WebGL mode.');
18+
}
19+
return;
20+
}
1321
//if html structure is not there yet
1422
if (!this.dummyDOM.querySelector(`#${idT}_summary`)) {
1523
return;

src/accessibility/textOutput.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import p5 from '../core/main';
1010

1111
//updates textOutput
1212
p5.prototype._updateTextOutput = function(idT) {
13+
// Check if the current rendering mode is WEBGL
14+
if (this._renderer && this._renderer instanceof p5.RendererGL) {
15+
if (!this._didOutputTextWebGLMessage) {
16+
this._didOutputTextWebGLMessage = true;
17+
console.error('textOutput() does not yet work in WebGL mode.');
18+
}
19+
return;
20+
}
1321
//if html structure is not there yet
1422
if (!this.dummyDOM.querySelector(`#${idT}_summary`)) {
1523
return;

0 commit comments

Comments
 (0)