3D地图生成后,绑定鼠标单击事件,点击地图无效。如果地图上有3d bar,点击bar是有响应的。
ECharts version [ECharts 版本]:
claygl, version 1.1.0
echarts, version 4.0.4
Brower version [浏览器类型和版本]:
firefox 58
正常响应点击事件
```javascript
option = {
viewControl:{
distance:200
},
geo3D: {
map:"中国",
boxWidth: 100,
boxHeight: 10,
regionHeight: 3,
groundPlane: { // 沙盘
show: false
},
itemStyle: {
areaColor: '#1d5e98',
opacity: 1,
borderWidth: 1,
borderColor: '#000'
},
label: {
show: false,
distance:5,
textStyle: {
color: '#000', //地图初始化区域字体颜色
fontSize: 8,
opacity: 1,
backgroundColor: 'rgba(0,23,11,0)'
}
},
emphasis: {
label: {
show: false
}
},
light: { //光照阴影
main: {
color: '#fff', //光照颜色
intensity: 1.2, //光照强度
shadow: true, //是否显示阴影
alpha:55,
beta:10
},
ambient: {
intensity: 0.3
}
}
},
series:[
{
name: 'bar3D',
type: "bar3D",
coordinateSystem: 'geo3D',
barSize: 2, //柱子粗细
shading: 'lambert',
opacity: 1,
bevelSize:0.5,
label: {
show: true,
formatter: '{b}'
},
data: [{"name":"大庆","value":[125.03,46.58,300]}]
},
{
name: 'scatter3D',
type: "scatter3D",
coordinateSystem: 'geo3D',
symbol: 'pin',
symbolSize: 30,
opacity: 1,
label: {
show: false,
formatter: '{b}'
},
itemStyle: {
borderWidth: 0.5,
borderColor: '#fff'
},
data: [{"name":"大庆","value":[125.03,46.58,300]}]
}
]
}
myChart.on('click',function(e){
funcOnClick(e);
});


修改为:
myChart.getZr().on('click',function(e){
funcOnClick(e);
});
地图上的点击事件分为数据区域和非数据区域的触发,加了getZr()后,不管是在非数据区域还是数据区域都能触发。
我的版本4.1.0,中国地图,单击事件无效,鼠标双击或者悬浮都能触发
update:
查看源代码
else if (name === 'click') {
if (this._downEl !== this._upEl
// Original click event is triggered on the whole canvas element,
// including the case that `mousedown` - `mousemove` - `mouseup`,
// which should be filtered, otherwise it will bring trouble to
// pan and zoom.
|| !this._downPoint
// Arbitrary value
|| dist(this._downPoint, [event.zrX, event.zrY]) > 4
) {
return;
}
this._downPoint = null;
}
第二个或判断为true,点击被拦截,删掉后两个或判断后单击事件正常
@surui0419 能点击,但是获取不到区域的信息呀?而且点击scatter3D等,也会触发
目前为止,echarts v4.2.0-rc.2, echarts-gl v1.1.1 geo3D中 单击事件还是无效
只有series里配置的数据可以响应点击事件....
能否让map3d和其它3d GL组件同时联用?
@pissang 是否可以获取点击区域的名称
Most helpful comment
目前为止,echarts v4.2.0-rc.2, echarts-gl v1.1.1 geo3D中 单击事件还是无效