xiefangzhenz commented on issue #5919: click 事件与拖动问题 URL: https://github.com/apache/incubator-echarts/issues/5919#issuecomment-441148155 @cuijian-dexter 非常感觉,这么快更新了。之前我用鼠标事件解决了,以下是处理方法。 过段时间我再次更新下新版本试试。 chart.on("click", function(param) { currentProvince = param.data.name; chart.dispatchAction({ type: 'downplay' }); chart.dispatchAction({ type: 'highlight', name: currentProvince }) if(currentProvince != "") { changeProvince(currentProvince) } }); chart.on("mousedown", function(param) { //因为mouseDownFun每次都会调用的,在这里重新初始化这个变量 isDrag = false; //延迟100ms timmerHandle = setTimeout(setDragTrue, 200); }); chart.on("mouseup", function(param) { if(!isDrag) { //先把doMouseDownTimmer清除,不然200毫秒后setGragTrue方法还是会被调用的 clearTimeout(timmerHandle); console.log("mouse up."); isClick = true; chart.dispatchAction({ type: 'downplay' }); chart.dispatchAction({ type: 'hideTip' }) chart.dispatchAction({ type: 'highlight', name: currentProvince }) } else { isDrag = false; console.log("draging over."); isClick = false; chart.dispatchAction({ type: 'downplay' }); chart.dispatchAction({ type: 'hideTip' }) chart.dispatchAction({ type: 'highlight', name: currentProvince }) } });
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
