antvis / g6-editor

532 stars 172 forks source link

自定义节点拖拽,导致堆栈溢出错误。 #92

Closed fallowu closed 5 years ago

fallowu commented 5 years ago

请参见codepen在线https://codepen.io/fallowu/pen/bzbgwV 拖拽到画布上的自定义节点,再次拖拽会导致g6Editor.js:7 Uncaught RangeError: Maximum call stack size exceeded image

fallowu commented 5 years ago

已解决。发现只定义image 一个shape会出现按照以下多定义一个rect就不会出现。顺序也不能反了。

          const ashape=group.addShape('rect', {
            attrs: {
              x: 0,
              y: 0,
              width: 100,
              height: 100,
              fill: 'black',
              stroke: '#CED4D9'
            }
          })    
         group.addShape('image', {
            attrs: {
              x: 0,
              y: 0,
              width: 100,
              height: 100,
              img: 'https://avatars1.githubusercontent.com/u/3997050?s=88&v=4'
            }
          })             
          return ashape