Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Google Maps V3可以看到多个世界副本时显示多个自定义标记_Javascript_Google Maps_Google Maps Api 3_Map - Fatal编程技术网

Javascript 使用Google Maps V3可以看到多个世界副本时显示多个自定义标记

Javascript 使用Google Maps V3可以看到多个世界副本时显示多个自定义标记,javascript,google-maps,google-maps-api-3,map,Javascript,Google Maps,Google Maps Api 3,Map,我已经创建了一个自定义OverlayView,其中包含一个canvas元素,使用的方法与找到的方法类似。一切都在相应地工作,但我正在寻找一些关于如何处理在较低的缩放级别上可以看到多个世界版本的情况的建议。目前,我将画布元素转换为: this.topLeft = new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getSouthWest().lng()); var divTopLeft = projection.fromLatLn

我已经创建了一个自定义OverlayView,其中包含一个canvas元素,使用的方法与找到的方法类似。一切都在相应地工作,但我正在寻找一些关于如何处理在较低的缩放级别上可以看到多个世界版本的情况的建议。目前,我将画布元素转换为:

this.topLeft = new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getSouthWest().lng());
var divTopLeft = projection.fromLatLngToDivPixel(this.topLeft);
this.canvas.style[this.cssTransformPrefix] = 'translate(' + Math.floor(divTopLeft.x) + 'px,' + Math.floor(divTopLeft.y) + 'px)';
要定位和绘制自定义标记之一,我使用以下方法:

var scale = Math.pow(2, map.zoom);
var offset = mapProjection.fromLatLngToPoint(this.centerPoint);

this.pxTopLeft.x = Math.floor(offset.x*scale);
this.pxTopLeft.y = Math.floor(offset.y*scale);

var worldPoint = mapProjection.fromLatLngToPoint(marker.position());
marker.draw(Math.floor(-this.pxTopLeft.x + worldPoint.x*scale), Math.floor(-this.pxTopLeft.y + worldPoint.y*scale));
使用此行为,当用户平移地图时,我的画布渲染标记将从一个世界实例捕捉到下一个世界实例。相反,我想要实现的是类似于本地谷歌标记行为的东西,即标记为世界的每个代表绘制一次。不幸的是,使用本地Google标记是不可能的。我怎样才能做到这一点