leaflet-splitmap icon indicating copy to clipboard operation
leaflet-splitmap copied to clipboard

bindPopup trigger Cannot read property 'call' of undefined

Open jeremy-saidani opened this issue 4 years ago • 1 comments

Hi,

I'am trying to add Popup to leaflet object in splitMap, but i'am getting this error :

TypeError: Cannot read property 'call' of undefined
NewClass.fire
src/core/Events.js:190
  187 | 			this._firingCount = (this._firingCount + 1) || 1;
  188 | 			for (var i = 0, len = listeners.length; i < len; i++) {
  189 | 				var l = listeners[i];
> 190 | 				l.fn.call(l.ctx || this, event);
      | ^  191 | 			}
  192 | 
  193 | 			this._firingCount--;

NewClass.removeLayer
src/layer/Layer.js:195
  192 | delete this._layers[id];
  193 | 
  194 | if (this._loaded) {
> 195 | 	this.fire('layerremove', {layer: layer});
      | ^  196 | 	layer.fire('remove');
  197 | }
  198 | 

NewClass.closePopup
src/layer/Popup.js:347
  344 | 		this._popup = null;
  345 | 	}
  346 | 	if (popup) {
> 347 | 		this.removeLayer(popup);
      | ^  348 | 	}
  349 | 	return this;
  350 | }

NewClass._close
src/layer/Popup.js:171
  168 | 
  169 | _close: function () {
  170 | 	if (this._map) {
> 171 | 		this._map.closePopup(this);
      | ^  172 | 	}
  173 | },
  174 | 

NewClass._onCloseButtonClick
src/layer/Popup.js:281
  278 | },
  279 | 
  280 | _onCloseButtonClick: function (e) {
> 281 | 	this._close();
      | ^  282 | 	DomEvent.stop(e);
  283 | },
  284 | 

HTMLAnchorElement.handler
src/dom/DomEvent.js:79
  76 | if (obj[eventsKey] && obj[eventsKey][id]) { return this; }
  77 | 
  78 | var handler = function (e) {
> 79 | 	return fn.call(context || obj, e || window.event);
     | ^  80 | };
  81 | 
  82 | var originalHandler = handler;
L.control.splitMap(leftPaneObjects, rightPaneObjects)

leftPaneObjects and rightPaneObjects are array of marker and polyline. I used L.marker().bindPopup() : this crash And L.popup() directly on map : this crash too I tried to add popup on different pane, but still crash

If anyone has a solution, that would help me a lot, thanks !

jeremy-saidani avatar Mar 23 '21 13:03 jeremy-saidani

hey I'm also facing this issue, did you find a solution to this?

deven740 avatar Mar 05 '22 19:03 deven740