@@ -45,6 +45,10 @@ export class ShapeBuilder {
4545 this . bufferStrides = { ...INITIAL_BUFFER_STRIDES } ;
4646 }
4747
48+ friendlyErrorsDisabled ( ) {
49+ return false ;
50+ }
51+
4852 constructFromContours ( shape , contours ) {
4953 if ( this . _useUserVertexProperties ) {
5054 this . _resetUserVertexProperties ( ) ;
@@ -151,24 +155,22 @@ export class ShapeBuilder {
151155 const vertexCount = this . geometry . vertices . length ;
152156 const MAX_SAFE_TESSELLATION_VERTICES = 50000 ;
153157
154- if ( vertexCount > MAX_SAFE_TESSELLATION_VERTICES ) {
155- const p5Class = this . renderer . _pInst . constructor ;
156- if (
157- ! p5Class . disableFriendlyErrors &&
158- ! this . renderer . _largeTessellationAcknowledged
159- ) {
160- const proceed = window . confirm (
161- '🌸 p5.js says:\n\n' +
162- `This shape has ${ vertexCount } vertices. Tessellating shapes with this ` +
163- 'many vertices can be very slow and may cause your browser to become ' +
164- 'unresponsive.\n\n' +
165- 'Do you want to continue tessellating this shape?'
166- ) ;
167- if ( ! proceed ) {
168- return ;
169- }
170- this . renderer . _largeTessellationAcknowledged = true ;
158+ if (
159+ vertexCount > MAX_SAFE_TESSELLATION_VERTICES &&
160+ ! this . friendlyErrorsDisabled ( ) &&
161+ ! this . renderer . _largeTessellationAcknowledged
162+ ) {
163+ const proceed = window . confirm (
164+ '🌸 p5.js says:\n\n' +
165+ `This shape has ${ vertexCount } vertices. Tessellating shapes with this ` +
166+ 'many vertices can be very slow and may cause your browser to become ' +
167+ 'unresponsive.\n\n' +
168+ 'Do you want to continue tessellating this shape?'
169+ ) ;
170+ if ( ! proceed ) {
171+ return ;
171172 }
173+ this . renderer . _largeTessellationAcknowledged = true ;
172174 }
173175
174176 this . isProcessingVertices = true ;
0 commit comments