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:28:20 UTC

[GitHub] [incubator-echarts] linwei-yoh opened a new issue #12733: graphic元素的回调方法触发不符合预期

linwei-yoh opened a new issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733


   ### Version
   4.8.0
   
   ### Reproduction link
   [https://gallery.echartsjs.com/editor.html?c=xTRRnlB9v0&comment=0](https://gallery.echartsjs.com/editor.html?c=xTRRnlB9v0&comment=0)
   
   ### Steps to reproduce
   1.点击任意一个graphic的点,查看弹出alert提示
   2.拖动一个点较长距离松开查看alert提示
   3.拖动任意点非常短距离例如0.1,松开查看alert提示
   
   ### What is expected?
   1.点击一个点仅触发onclick
   2.短距离的拖动仅触发drag事件
   
   ### What is actually happening?
   1.先触发drag 再触发onclick
   2.额外触发了onclick
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   


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


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

Posted by GitBox <gi...@apache.org>.
wf123537200 commented on issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733#issuecomment-637382936


   极短距离的话感觉你的处理方式是合理的
   当前这种避免mouseup,click相关事件冲突的方式应该属于常规方法,应该也没有其他特别好的办法


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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
linwei-yoh closed issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733


   


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


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

Posted by GitBox <gi...@apache.org>.
linwei-yoh commented on issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733#issuecomment-637384335


   那只能如此使用先  感谢回复
   


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


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

Posted by GitBox <gi...@apache.org>.
linwei-yoh commented on issue #12733:
URL: https://github.com/apache/incubator-echarts/issues/12733#issuecomment-637365713


   感谢回复,
   
   问题1 Click额外触发的drag确实可以用这种方法解决.目前也是这样做的.只是感觉有点恶心人.所以用issues提醒下,顺便看看有没希望不用额外的判断进行处理.
   
   问题2 只是极短距离的拖动会额外触发onclick请问有没什么好的方法处理. 
   目前也是再上面的那个距离判断中加了一个极短距离的位移(!=0),当此的onclick触发无效.


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