简体   繁体   English

Primefaces gmap标记:setAnimation BOUNCE

[英]Primefaces gmap marker: setAnimation BOUNCE

I have some GPS coordinates to display in my application using Primefaces. 我有一些GPS坐标要使用Primefaces显示在我的应用程序中。 I use p:map widget + polling without particolar problems. 我使用p:map窗口小部件+轮询而没有特殊问题。 Now i would like to make last marker (actual position) with animation BOUNCE. 现在,我想用动画BOUNCE做最后一个标记(实际位置)。 In primefaces setAnimation method doesn't exixt yet. 在primefaces中,setAnimation方法尚未存在。 JavaScrpit can do the job? 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>

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"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM