diff --git a/src/components/DistortableImage.Keymapper.js b/src/components/DistortableImage.Keymapper.js index 0f191a1ab..f55287483 100644 --- a/src/components/DistortableImage.Keymapper.js +++ b/src/components/DistortableImage.Keymapper.js @@ -126,7 +126,7 @@ L.DistortableImage.Keymapper = L.Handler.extend({ }, _injectIconSet() { - if (document.querySelector('#keymapper-iconset')) { return; } + if (this._map.getContainer().querySelector('#keymapper-iconset')) { return; } const el = L.DomUtil.create('div', ''); el.id = 'keymapper-iconset'; @@ -135,7 +135,7 @@ L.DistortableImage.Keymapper = L.Handler.extend({ this._iconset = new L.KeymapperIconSet().render(); el.innerHTML = this._iconset; - document.querySelector('.leaflet-control-container').appendChild(el); + this._map.getContainer().querySelector('.leaflet-control-container').appendChild(el); }, }); diff --git a/src/edit/actions/EditAction.js b/src/edit/actions/EditAction.js index ed8073575..e90d845d5 100644 --- a/src/edit/actions/EditAction.js +++ b/src/edit/actions/EditAction.js @@ -69,7 +69,7 @@ L.EditAction = L.Toolbar2.Action.extend({ }, _injectIconSet() { - if (document.querySelector('#iconset')) { + if (this._map.getContainer().querySelector('#iconset')) { return; } @@ -78,7 +78,7 @@ L.EditAction = L.Toolbar2.Action.extend({ el.setAttribute('hidden', 'hidden'); el.innerHTML = new L.ToolbarIconSet().render(); - document.querySelector('.leaflet-marker-pane').appendChild(el); + this._map.getContainer().querySelector('.leaflet-marker-pane').appendChild(el); }, _enableAction() {