zhongrj
2025-11-25 b89962006164a462404b79a738bee8cbb6d7fe7e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PluginsAPI.Map.willAddControls([
        'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.js',
        'gpslocation/node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.css'
    ], function(args, _){
 
    // TODO: how to specify consistent plugin render ordering?
    // we use a timeout to make sure this button is rendered last
    // but a better method is warranted
    setTimeout(function(){
        L.control.locate({
            position: 'bottomleft',
            showPopup: false,
            locateOptions: {
                enableHighAccuracy: true
            },
            strings: {
                title: "Show My Location"
            }
        }).addTo(args.map);
    }, 150);
});