fixed problem in google maps with wrapped maps
This commit is contained in:
parent
e642ae0e09
commit
9a0ac46ef3
@ -443,6 +443,14 @@ CanvasLayer.prototype.repositionCanvas_ = function() {
|
||||
// overlayView's projection, not the map's
|
||||
var projection = this.getProjection();
|
||||
var divTopLeft = projection.fromLatLngToDivPixel(this.topLeft_);
|
||||
|
||||
console.log(this.topLeft_.lng(), divTopLeft.x);
|
||||
// when the zoom level is low, more than one map can be shown in the screen
|
||||
// so the canvas should be attach to the map with more are in the screen
|
||||
var mapSize = (1 << this.getMap().getZoom())*256;
|
||||
if (Math.abs(divTopLeft.x) > mapSize) {
|
||||
divTopLeft.x -= mapSize;
|
||||
}
|
||||
this.canvas.style[CanvasLayer.CSS_TRANSFORM_] = 'translate(' +
|
||||
Math.round(divTopLeft.x) + 'px,' + Math.round(divTopLeft.y) + 'px)';
|
||||
|
||||
|
@ -105,6 +105,13 @@ GMapsTileLoader.prototype = {
|
||||
},
|
||||
|
||||
getTilePos: function (tilePoint) {
|
||||
var limit = (1 << this._map.getZoom());
|
||||
// wrap tile
|
||||
tilePoint = {
|
||||
x: ((tilePoint.x % limit) + limit) % limit,
|
||||
y: tilePoint.y
|
||||
};
|
||||
|
||||
tilePoint = new google.maps.Point(
|
||||
tilePoint.x * this.tileSize,
|
||||
tilePoint.y * this.tileSize
|
||||
|
Loading…
Reference in New Issue
Block a user