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

Get MarkerLayer location on "dragend" event #86

Open
zzarcon opened this issue Dec 12, 2014 · 0 comments
Open

Get MarkerLayer location on "dragend" event #86

zzarcon opened this issue Dec 12, 2014 · 0 comments

Comments

@zzarcon
Copy link

zzarcon commented Dec 12, 2014

Hi guys, I have a MapView with a MarkerCollectionLayer as childLayers, and that MarkerCollectionLayer has a MarkerLayer that extends the DraggableMixin, so I'm trying to get the location of the MarkerLayer when it's dragged...

var markerLayer = EmberLeaflet.MarkerLayer.extend(EmberLeaflet.DraggableMixin, EmberLeaflet.PopupMixin, {
  dragend: function() {
     //The value of this.get('location') is always the same
  }
});

var marker = EmberLeaflet.MarkerCollectionLayer.extend({
  itemLayerClass: markerLayer,
  events: ['click'],

  content: function() {
    var lat = this.get('controller.geolocator.latitude');
    var lon = this.get('controller.geolocator.longitude');

    return [{location: L.latLng(lat, lon)}];
  }.property('controller.geolocator.latitude', 'controller.geolocator.longitude')
});

export default EmberLeaflet.MapView.extend({
  zoom: 15,
  options: {maxZoom: 19, minZoom: 0},
  events: ['click'],
  childLayers: [EmberLeaflet.DefaultTileLayer, marker],

  center: function() {
    return L.latLng(
      this.get('controller.geolocator.latitude'),
      this.get('controller.geolocator.longitude')
    );
  }.property('controller.geolocator.latitude', 'controller.geolocator.longitude')
});

The problem is that in the dragend handler I'm getting always the same value :(.
What I'm doing wrong?
Thanks!!!

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