Как динамически сделать паузу в пути Ant с помощью Leaflet? - PullRequest
0 голосов
/ 05 августа 2020

Установив флажок, я хотел бы приостановить или воспроизвести анимацию Ant, как я могу этого добиться?

            const path = antPath(latlngs,
            {
                "delay": 800,
                "dashArray": [10,20],
                "weight": 4,
                "color": "#0000FF",
                "pulseColor": "#FFFFFF",
                "paused": true or false (depending on chekbox result),
                "reverse": false,
                "hardwareAccelerated": true
            });

Большое спасибо

1 Ответ

0 голосов
/ 07 августа 2020

Наконец, решение ...

        <div class="col-sm-12">
            <label for="PathCheck">PathSimulation Pause</label>
            <input type="checkbox" id="PathCheck" onclick="IsChecked()">
            <label for="PathCheck">PathSimulation Hide</label>
            <input type="checkbox" id="PathHide" onclick="IsHide()">
        <div id="ChartGeoJson"/>

    <script type="text/javascript">
        function IsChecked()
        {
            var checkBox = document.getElementById("PathCheck");

            if(checkBox.checked==true)
            {path.pause();}
            else
            {path.resume();}
        }

        function IsHide()
        {
            var checkBox = document.getElementById("PathHide");

            if(checkBox.checked==true)
            {mymap.removeLayer(path);}
            else
            {mymap.addLayer(path);}
        }

        var path;
        var mymap;

...

...