ecomfe / echarts-gl

Extension pack for Apache ECharts, providing globe visualization and 3D plots.
BSD 3-Clause "New" or "Revised" License
2.6k stars 844 forks source link

geo3D中 ’geoselectchanged‘ 事件不触发,click事件中target为undefined #389

Open ThomasXing opened 3 years ago

ThomasXing commented 3 years ago

代码:

geo3D: {
          map: 'china',
          // boxWidth: 100,
          boxHeight: 20,
          shading: "color",
          colorMaterial: {
            detailTexture: mapTexture,
            // detailTexture: '/earth/echarts/gradient.png',
          },
          environment: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
            offset: 0, color: '#00aaff' // 天空颜色
          }, {
            offset: 0.7, color: '#998866' // 地面颜色
          }, {
            offset: 1, color: '#998866' // 地面颜色
          }], false),
          label:{
            show: true,
            distance: 0,
            color: '#FFFFFF',
            formatter:function(params){
              if(params.name.indexOf('内蒙古' || '黑龙江') > -1) return params.name
              return params.name.slice(0,2)
            }
          },
          emphasis:{
            label:{
              show: true,
            }
          },
          light: {
            main: {
              intensity: 1
            },
            ambient: {
              intensity: 0
            },
            ambientCubemap: {
              diffuseIntensity: 1,
              texture: '/earth/echarts/data-1491896094618-H1DmP-5px.hdr'
            }
          },
          itemStyle: {
            // opacity: 0.5,
            borderWidth: 1,
            borderColor: 'rgba(0, 134, 254,.5)'
          },
          postEffect: {
            enable: true,
            bloom: {
              enable: true
            },
            screenSpaceAmbientOcclusion: {
              radius: 1,
              intensity: 1,
              enable: true,
              quality: 'high'
            },
            screenSpaceReflection: {
              enable: true
            },
          },
        },

       myChart.on('geoselectchanged', function(event){
          console.log(event)
        })
        myChart.getZr().on('click', function (event) {
          console.log(event)
          if (!event.target) {
            // 点击在了空白处,做些什么。
          }
        });
ThomasXing commented 3 years ago
hudenghui commented 3 years ago

遇到了同样的问题,按着官方文档说法,geo和geo3d参数是通用,但是我把selectedMode设置为single,依然不能触发geoselectchanged事件

luo-geng commented 2 years ago

插个眼,遇到同样的问题

Xingkong4183 commented 1 year ago

相同问题 咋解决噢