File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/extensions/renderer/canvas/webgl Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -556,11 +556,10 @@ export class ElementDrawingWebGL {
556556 return ;
557557 }
558558
559- // Edges are not drawn as textures
560- // Edges with invalid points could be passed here, causing errors
559+ // Edges with invalid points could be passed here (labels), causing errors
561560 // Ref: Random "Script Error" thrown when generating nodes and edges in newest webgl version #3365
562561 // https://github.com/cytoscape/cytoscape.js/issues/3365
563- if ( ele . isEdge ( ) ) {
562+ if ( ele . isEdge ( ) && ! this . _isValidEdge ( ele ) ) {
564563 return ;
565564 }
566565
@@ -997,11 +996,21 @@ export class ElementDrawingWebGL {
997996 }
998997 }
999998
999+ _isValidEdge ( edge ) {
1000+ const rs = edge . _private . rscratch ;
1001+
1002+ if ( rs . badLine || rs . allpts == null || isNaN ( rs . allpts [ 0 ] ) ) { // isNaN in case edge is impossible and browser bugs (e.g. safari)
1003+ return false ;
1004+ }
1005+
1006+ return true ;
1007+ }
1008+
10001009 _getEdgePoints ( edge ) {
10011010 const rs = edge . _private . rscratch ;
10021011
10031012 // if bezier ctrl pts can not be calculated, then die
1004- if ( rs . badLine || rs . allpts == null || isNaN ( rs . allpts [ 0 ] ) ) { // isNaN in case edge is impossible and browser bugs (e.g. safari)
1013+ if ( ! this . _isValidEdge ( edge ) ) { // isNaN in case edge is impossible and browser bugs (e.g. safari)
10051014 return ;
10061015 }
10071016 const controlPoints = rs . allpts ;
You can’t perform that action at this time.
0 commit comments