我正在将代码转换V2
为V3
,以下代码是google map
V2
代码。在警报中,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
代码中,在alert undefined value sw.x
is来的时候,如何取回.sw.x
V3