jeudi 19 janvier 2017

ember-leaflet drag point to latlng

on my polygon 'dragend' function i get the new position via (e.target._newPos) that represents the position on my layer.

But when i convert that point as follows:

  let containerPoint = layer._map.layerPointToContainerPoint(e.target._newPos);
  let latlng = layer._map.containerPointToLatLng(containerPoint);

i get some coordinates that's what i want. But when i try to present them on my leaflet map layer an zoomin or out that point jumps on my map so wtf is going on?

import PolygonLayer from 'ember-leaflet/components/polygon-layer';

. . .

draggable.on('dragend', (e) => {
    let containerPoint = layer._map.layerPointToContainerPoint(e.target._newPos);
    let latlng = layer._map.containerPointToLatLng(containerPoint);
    let dragEnd = this.get('onDragEnd');
    dragEnd(latlng);
  });




Aucun commentaire:

Enregistrer un commentaire