0

我尝试将 pelias 传单地理编码器(https://github.com/pelias/leaflet-plugin)添加到 django-leaflet 的小部件。添加了下面的脚本,我可以看到添加了地理编码器图标并且功能正确。

window.addEventListener("map:init", function (event) {
    var map = event.detail.map; //
    var options = {
    url: "http://localhost:3100/v1",
    expanded: false,
    bounds: false,
    sources: 'whosonfirst'
    };
    geocontrol = L.control.geocoder(options);
    geocontrol.addTo(map);
});

但是这样它就不会更新 geom 字段的关联文本区域。

我尝试修改leaflet-control-geocoder 以触发L.Draw.Event.CREATED 而不仅仅是addLayer,但是leaflet.forms.js 使用一个标志来忽略其他绘制控件的事件:

        // We use a flag to ignore events of other draw controls
        for (var toolbar in drawControl._toolbars) {
            drawControl._toolbars[toolbar].on('enable disable', function (e) {
                this._acceptDrawEvents = e.type === 'enable';
            }, this);
        }

知道如何做到这一点吗?我找不到为地理编码器控制设置 _acceptDrawEvents 的地方。

谢谢!

4

0 回答 0