谷歌地球插件点击崩溃

Google Earth Plugin Crash on Click

本文关键字:崩溃 插件 谷歌地球      更新时间:2023-09-26

我目前正试图在浏览器的调试窗口中设置断点。每当点击事件发生时,断点就会导致Google Earth插件崩溃。

为了避免崩溃,我缺少什么方法吗?我只想在断点上轻松地尝试不同的kml属性。希望我错过了一个类似于警报框超时的功能,以防止单击GE时框崩溃。

尝试在Chrome和IE中进行调试。

这是谷歌地球的基本代码。

google.earth.createInstance(this, initCB, failureCB, earthArgs);

this是地图div,earthArgs保存数据库位置

点击事件代码:

function initCB(instance) {
  gep = instance;
  gep.getWindow().setVisibility(true);
  google.earth.addEventListener(gep.getGlobe(), 'click', function(event) { 
    //set breakpoint here
  });
}

代码可以正常工作并加载GE,但问题是当单击GE时,断点会冻结。

这可能是因为您正在为事件处理程序使用匿名委托。要设置断点,请尝试创建一个命名函数并将其传递给addEventListener方法。

 // handle click events on the globe
 // e is the KmlMouseEvent object
 var globeClickHandler = function(e) {
   // set breakpoint here
 };
 // in initCB
 google.earth.addEventListener(gep.getGlobe(), 'click', globeClickHandler);

如果使用不同的事件会怎样?说"mousedown"还是"mouseup"?

google.earth.addEventListener(gep.GetGlobe(), 'mouseup', function(event){ 
    //do something here  
});