我正在尝试在页面上自动显示地图,所以这是我的coffeescript:
handler = Gmaps.build('Google')
# Options list: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
mapOptions =
mapTypeId: google.maps.MapTypeId.HYBRID
mapTypeControl: false
zoomControl: false
streetViewControl: false
panControl: false
overviewMapControl: false
scaleControl: false
draggable: false
handler.buildMap({ provider: mapOptions, internal: {id: 'map'}}, () -> handler.getMap().setZoom(2))
mapPanFx = (time) ->
handler.getMap().panBy(x: 20, y: 0)
window.requestAnimationFrame(mapPanFx)
mapStartPanFx = () -> window.requestAnimationFrame(mapPanFx)
mapStartPanFx()
调用mapStartPanFx会导致地图从屏幕上完全消失。 gmaps4rails和动画不应该一起工作吗?