Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When you change icon in leaflet, you lose the draggability #58

Open
gabesmed opened this issue Jun 17, 2014 · 0 comments
Open

When you change icon in leaflet, you lose the draggability #58

gabesmed opened this issue Jun 17, 2014 · 0 comments

Comments

@gabesmed
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant