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/02 07:55:53 UTC

[GitHub] [incubator-echarts] wf123537200 commented on issue #12733: graphic元素的回调方法触发不符合预期

wf123537200 commented on issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733#issuecomment-637361681


   这个是时间执行顺序问题,简单来说可以用dragstart和dragend来判断一下就解决问题了,上下代码, 具体移动多少,可以自己判断和设置,看看能不能解决你的问题
   
   ```
   var p = {}
   function dragStart(dataIndex, e) {
       console.log('dragStart Event');
       p.x = e.event.offsetX
       p.y = e.event.offsetY
   }
   
   function dragEnd(dataIndex, e) {
       var x = e.event.offsetX
       var y = e.event.offsetY
       // 判断移动距离
       if(Math.abs(x - p.x) > 50 || Math.abs(y - p.y) > 50) {
           console.log('dragEnd Event');    
       }
   }
   
   function PointClick(dataIndex, e, dy) {
       console.log('Click Event');
   }
   ```


----------------------------------------------------------------
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