Sencha 方向缩放
所有,
当我使用 Google 地图的方向服务时,地图似乎总是缩放至 0 级(我可以概览整个地图)。
当我在注释中设置方向代码时,缩放级别运行良好。
这是我的代码:
/**
* Update route
*/
updateRoute: function ()
{
// route
var start = "Belgium";
var end = "France";
var request =
{
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
var directionsDisplay = new google.maps.DirectionsRenderer();
var directionsService = new google.maps.DirectionsService();
directionsDisplay.setMap(this.items.items[0].map);
directionsService.route(request, function(response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections(response);
}
});
}
这是我得到的:
希望有人可以帮助我吗?
提前致谢!
All,
When I use the Directions-service from Google Maps, it seems like the map always goes to zoom level 0 (I get an overview of the whole map).
When I set the code for the directions in comment, the zoom level is working well.
This is my code:
/**
* Update route
*/
updateRoute: function ()
{
// route
var start = "Belgium";
var end = "France";
var request =
{
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
var directionsDisplay = new google.maps.DirectionsRenderer();
var directionsService = new google.maps.DirectionsService();
directionsDisplay.setMap(this.items.items[0].map);
directionsService.route(request, function(response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections(response);
}
});
}
This is what I get:
Hopefully someone can help me with this?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
地图会自动缩小到显示整个路线所需的范围...我尝试了您的代码...如果您选择起点和原点作为两个较近的地方(最好是同一区域/城市),则缩放级别将变为根据距离的不同,可以降低到 15-16……
由于您基本上选择了比利时和法国(这两个区域都是非常广阔的区域,而不是单个地图点(可以这么说),因此缩放级别会降低到 1 : )
希望这有帮助
The map automatically zooms out to the range required to display the entire route.... I tried ur code.... If you select the start and origin as two places closer (preferably the same area/city) then the zoom level goes down to like 15-16 depending on the distance....
Since you've basically selected Belgium and France (both of which are really broad areas and not a single map point (so to speak) the zoom level goes down to 1 :)
Hope this helps