【发布时间】:2018-09-22 19:40:30
【问题描述】:
我从传单和leaflet.draw 开始,但在尝试更改标记图标时遇到了麻烦。
在这种特殊情况下,当我按下取消编辑按钮时,我会尝试更新所有标记的图标。我可以更改图标,但所有标记仍处于选中状态
这是一个小提琴example
复制步骤
- 按下编辑按钮
- 按取消编辑
- 您会看到所有标记都更改了它们的图标,但同时所有标记仍处于选中状态
这是我必须模拟撤消图标更改的代码:
drawControl._toolbars.edit.disable = function () {
if (!this.enabled()) {
/* If you need to do something right as the
edit tool is enabled, do it here right
before the return */
return;
}
geojsonLayer.eachLayer(function(layer) {
layer.setIcon(new L.Icon.Default({}));
});
geojsonLayer2.eachLayer(function(layer) {
layer.setIcon(new L.Icon.Default({}));
});
this._activeMode.handler.revertLayers();
L.Toolbar.prototype.disable.call(this);
};
版本: 传单 1.3.4 传单.draw 1.0.3
我做错了什么?
【问题讨论】:
-
你的小提琴有错误。请再次检查。
-
您好@kboul,我在提琴手的控制台中看不到任何错误。您在哪里看到错误?
-
地图图块未渲染。
Failed to load resource: net::ERR_NAME_NOT_RESOLVED5939.png -
我明白你在说什么。这是一个编辑提琴手jsfiddle.net/roywtaje/30
标签: leaflet leaflet.draw