【发布时间】:2013-06-20 13:48:18
【问题描述】:
我正在将代码V2转换为V3,下面的代码是google mapV2代码。在警报sw.x 中,一些值即将到来。
//Google map V2 code:
function flagIntersectingMarkers() {
var pad = this.borderPadding;
var zoom = this.map.getZoom();
var projection = this.map.getCurrentMapType().getProjection();
var bounds = this.map.getBounds();
var sw = bounds.getSouthWest();
sw = projection.fromLatLngToPixel(sw, zoom);
alert("sw"+sw.x); // In this alert some value is coming
sw = new GPoint(sw.x-pad, sw.y+pad);
sw = projection.fromPixelToLatLng(sw, zoom, true);
}
//Google map V3 code:
function flagIntersectingMarkers() {
var pad = this.borderPadding;
var zoom = this.map.getZoom();
var projection = this.map.getProjection();
var bounds = this.map.getBounds();
var sw = bounds.getSouthWest();
sw = projection.fromLatLngToPoint(sw, zoom);
alert("sw"+sw.x); // Undefined value is coming
sw = new google.maps.Point(sw.x-pad, sw.y+pad);
sw = projection.fromPointToLatLng(sw, zoom, true);
}
但是在上面的V3代码中,在sw.x未定义值即将到来的警报中,如何检索V3中的sw.x值。
【问题讨论】:
-
您好,任何机构都可以帮助将 V2 迁移到 V3。
标签: google-maps google-maps-api-3 google-maps-api-2