nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 3d366422ad65de284be435c1d49aa310253bd672
parent 5c0191a063a2aeefb679c29ebc25c2194ba12c29
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sat, 25 Feb 2017 00:15:46 +0300

[layers hotkeys] change label, do not change stored layer name

Diffstat:
Msrc/lib/leaflet.control.layers.hotkeys/index.js | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/lib/leaflet.control.layers.hotkeys/index.js b/src/lib/leaflet.control.layers.hotkeys/index.js @@ -14,7 +14,7 @@ function extendLayerName(name, layer) { function enableHotKeys(control) { const originalOnAdd = control.onAdd; const originalOnRemove = control.onRemove; - const originalAddLayer = control._addLayer; + const originalAddItem = control._addItem; if (control._hotKeysEnabled) { return control; @@ -23,9 +23,10 @@ function enableHotKeys(control) { L.Util.extend(control, { _hotKeysEnabled: true, - _addLayer: function(layer, name, overlay) { - name = extendLayerName(name, layer); - return originalAddLayer.call(this, layer, name, overlay); + _addItem: function(obj) { + obj = L.Util.extend({}, obj); + obj.name = extendLayerName(obj.name, obj.layer); + return originalAddItem.call(this, obj); }, onAdd: function(map) {