我有一些GPS坐标可以在我的应用程序中使用Primefaces显示。我使用p:map widget + polling而没有特殊问题。现在我想用动画BOUNCE制作最后一个标记(实际位置)。在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>
答案 0 :(得分:0)
我找到了解决方案:
<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"/>