ecomfe / echarts-gl

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

监听 grid3D.viewControl.beta changed #123

Open FunctionRun opened 7 years ago

FunctionRun commented 7 years ago

echarts-gl: 1.0.0-beta.4 qtek: 0.4.1 echarts: 3.6.2 zrender: 3.5.2

我想要监听 grid3D.viewControl.beta 改变的事件, 比如可以这样

myChart.on('viewControlChange', (viewControlParam) => {
    const beta = viewControlParam.beta;
    // when beta = 90 -> do something

})

我现在的代码是这样

const tick = (timestamp) => {
    const beta = myChart.getOption().grid3D[0].viewControl.beta;
    if(beta > 89.5 && beta < 90.5) {
        //do something
    } else {
        window.requestAnimationFrame(tick);
    }
}

window.requestAnimationFrame(tick);

我认为这样不好,getOption 一直被调用

pissang commented 7 years ago

试试

myChart.on('grid3dcamerachanged', function () {})
wangz-code commented 1 year ago

makr 3d gl 图表监听viewControl 解决方案

myChart.on("grid3dcamerachanged", function (e) {
    console.log("e log==>", e);
});