0

I have some GPS coordinates to display in my application using Primefaces. I use p:map widget + polling without particolar problems. Now i would like to make last marker (actual position) with animation BOUNCE. In primefaces setAnimation method doesn't exixt yet. JavaScrpit can do the job?

    <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>
Alessandro Mattiuzzi
  • 2,309
  • 2
  • 18
  • 24

1 Answers1

0

I found a solution:

<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"/>
Alessandro Mattiuzzi
  • 2,309
  • 2
  • 18
  • 24