JavaScript谷歌地图setcenter和setzoom与动画 [英] javascript google map setcenter and setzoom with animation

查看:393
本文介绍了JavaScript谷歌地图setcenter和setzoom与动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在javascript中使用google map api,我需要通过来自restful service的值来改变缩放和居中,我可以用setCenter和setZoom函数来实现。



但问题是,地图重新加载,我的老板希望它通过动画来关注那个位置,而不是通过重新加载地图是否有这样做?

解决方案

方法 setCenter 重新加载地图。如果没有进行充值并有动画,请使用 panTo 方法: Map.panTo Developers Documentation


I am using google map api in javascript, i need to change zoom and center by the value coming from restful service and i can do that with setCenter and setZoom functions.

But the problem is that, map is reloading and my boss want it to focus that location with an animation not by reloading map is there anyway for doing so?

解决方案

The method setCenter reload the map. For not having the recharge and have an animation, use the panTo method: Map.panTo Developers Documentation

这篇关于JavaScript谷歌地图setcenter和setzoom与动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆