0
point = map.fromContainerPixelToLatLng(new GLatLng(x,y));}
在V3我這樣做:
point = map.MapCanvasProjection.fromContainerPixelToLatLng(new LatLng(x,y));
和錯誤..
該怎麼做?
感謝
point = map.fromContainerPixelToLatLng(new GLatLng(x,y));}
在V3我這樣做:
point = map.MapCanvasProjection.fromContainerPixelToLatLng(new LatLng(x,y));
和錯誤..
該怎麼做?
感謝
據我知道地圖類沒有一個MapCanvasProjection財產。如果他們最近添加了一個,它不在規範中。
有一個工作,你身邊可以通過創建一個虛擬OverlayView的,這將有一個投影做的:
/**@private
* In V3 it is quite hard to gain access to Projection and Panes.
* This is a helper class
* @param {google.maps.Map} map
*/
function ProjectionHelperOverlay(map) {
google.maps.OverlayView.call(this);
this.setMap(map);
}
ProjectionHelperOverlay.prototype = new google.maps.OverlayView();
ProjectionHelperOverlay.prototype.draw = function() {
if (!this.ready) {
this.ready = true;
google.maps.event.trigger(this, 'ready');
}
};
這是一個從this open source code拍攝。你可以這樣使用它:
var proj = new ProjectionHelperOverlay(map);
proj.getProjection().fromContainerPixelToLatLng(new LatLng(x,y));
this.set_map ???這是這個功能? – zjm1126 2010-03-31 06:47:28
@ zjm1126哎呀,對不起,這段代碼一定是陳舊的。它的setMap() – Bob 2010-03-31 08:43:00