You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/06/30 01:19:15 UTC

[GitHub] [incubator-echarts] peach5460 edited a comment on issue #12851: dragging以后position错误

peach5460 edited a comment on issue #12851:
URL: https://github.com/apache/incubator-echarts/issues/12851#issuecomment-647892763


   进一步的问题,伪代码如下:
   伪代码
   
   ```
   function onShapeDragend(e) {
     //...获取polygon
   
     // 遍历polygon的点,将position叠加上去
     for (let index = 0; index < points.length; index++) {
       points[index][0] = points[index][0] + this.position[0];
       points[index][1] = points[index][1] + this.position[1];
     }
     
     // 替换原来的polygon的点
     myChart.setOption({
       graphic: [
         {
           id: id,
           shape: { points: points },
           position: [0, 0],
         },
       ],
     });
   }
   ```
   
   如果我再dragend事件里,将这个polygon的坐标手动叠加position,然后将position强制设为【0,0】,拖动几次以后,整个echart的基本对象坐标体系就全乱了,polygon再也选不中了(绘制的位置和鼠标拾取的位置不在一个地方)。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org