我有一些GPS坐标要使用Primefaces显示在我的应用程序中。我使用p:map widget + polling,没有粒子问题。现在我想用动画反弹来做最后一个标记(实际位置)。在primefaces中,setAnimation方法还不存在。JavaScrpit可以做这项工作吗?
<p:poll interval="60" listener="#{mapPage.modelRefresh}" oncomplete="handleComplete(xhr, status, args)" update="gMap"/>
<p:gmap widgetVar="gMap" id="gMap" center="45.893378,12.32402" zoom="10" type="ROADMAP" style="width:100%;height:80vh"
model="#{mapPage.model}" >
<p:ajax event="overlaySelect" listener="#{mapPage.onMarkerSelect}" />
<p:gmapInfoWindow id="infoWindow">
<p:outputPanel style="text-align: center; display: block; margin: auto">
<h:outputText value="#{mapPage.marker.text}" />
</p:outputPanel>
</p:gmapInfoWindow>
</p:gmap>
</h:body>发布于 2015-11-04 00:00:28
我找到了一个解决方案:
<script>
function update() {
var gmap = PF('gMap').getMap();
for (var i in gmap.markers) {
var oldMarker = gmap.markers[i];
}
oldMarker.setAnimation(google.maps.Animation.BOUNCE); }
</script>
<poll interval="60" listener="#{mapPage.modelRefresh}" oncomplete="update()" update="gMap"/>https://stackoverflow.com/questions/33479581
复制相似问题