Closed miguelcobain closed 10 years ago
There's actually some code for this already: look in utils.js: EmberLeaflet.computed.optionProperty
.
Is there a specific option you'd like to be added to the default options that have convenient bindings?
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.
oh nice good call. making a separate issue for this.
@gabesmed, from what I can tell, the optionProperty
isn't delay tolerant yet. Am I right?
Like @codefox421 stated in #38: "If the layer does not exist, propagate style changes to the layer once it exists".
Yeah I don't think it is. But styleProperty
and pathStyleProperty
are, and tested. And optionProperty
could be made to be.
This issue is about optionProperty
, so I think it should be reopened. I'll try to tackle this in the next days.
Like stated on #38, something similar is needed for option properties.
How hard could this be?