ember-leaflet
ember-leaflet copied to clipboard
When you change icon in leaflet, you lose the draggability
via @miguelcobain:
Actually, there is a problem with icon binding (which is pretty useful):
When you change icon in leaflet, you lose the draggability. So you need to restore it.
I use this code:
iconBinding: 'content.icon',
_updateLayerOnIconChange: Ember.observer(function(){
var newIcon = get(this, 'icon');
var oldIcon = this._layer && this._layer.options.icon;
if(oldIcon && newIcon && oldIcon !== newIcon) {
var draggable = this._layer.dragging.enabled();
this._layer.setIcon(newIcon);
if(draggable) this._layer.dragging.enable();
else this._layer.dragging.disable();
}
}, 'content.icon'),
I don't have much time right now, but it would be nice to have failing tests for this.