Skip to content

Commit

Permalink
better fix for #41
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofsumit committed Aug 17, 2016
1 parent cccb4b0 commit 4a0417d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
24 changes: 17 additions & 7 deletions dist/leaflet.pm.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,26 @@ L.PM.Edit.Poly = L.Class.extend({
rightM._middleMarkerLeft = middleMarker;

middleMarker.on('click', function() {

// TODO: move the next two lines inside _addMarker() as soon as
// https://github.com/Leaflet/Leaflet/issues/4484
// is fixed
var icon = L.divIcon({className: 'marker-icon'});
middleMarker.setIcon(icon);

self._addMarker(middleMarker, leftM, rightM);
});
middleMarker.on('movestart', function() {

// TODO: This is a workaround. Remove the moveend listener and callback as soon as this is fixed:
// https://github.com/Leaflet/Leaflet/issues/4484
middleMarker.on('moveend', function() {
var icon = L.divIcon({className: 'marker-icon'});
middleMarker.setIcon(icon);

middleMarker.off('moveend');
});

self._addMarker(middleMarker, leftM, rightM);
});

Expand All @@ -475,13 +492,6 @@ L.PM.Edit.Poly = L.Class.extend({
newM.off('movestart');
newM.off('click');

// TODO: This is a workaround. Remove this event do the callback right here when when this issue is fixed:
// https://github.com/Leaflet/Leaflet/issues/4484
newM.on('moveend', function() {
var icon = L.divIcon({className: 'marker-icon'})
newM.setIcon(icon);
});

// now, create the polygon coordinate point for that marker
var latlng = newM.getLatLng();
var coords = this._poly._latlngs[0];
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet.pm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions src/js/L.PM.Edit.Poly.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,26 @@ L.PM.Edit.Poly = L.Class.extend({
rightM._middleMarkerLeft = middleMarker;

middleMarker.on('click', function() {

// TODO: move the next two lines inside _addMarker() as soon as
// https://github.com/Leaflet/Leaflet/issues/4484
// is fixed
var icon = L.divIcon({className: 'marker-icon'});
middleMarker.setIcon(icon);

self._addMarker(middleMarker, leftM, rightM);
});
middleMarker.on('movestart', function() {

// TODO: This is a workaround. Remove the moveend listener and callback as soon as this is fixed:
// https://github.com/Leaflet/Leaflet/issues/4484
middleMarker.on('moveend', function() {
var icon = L.divIcon({className: 'marker-icon'});
middleMarker.setIcon(icon);

middleMarker.off('moveend');
});

self._addMarker(middleMarker, leftM, rightM);
});

Expand All @@ -118,13 +135,6 @@ L.PM.Edit.Poly = L.Class.extend({
newM.off('movestart');
newM.off('click');

// TODO: This is a workaround. Remove this event do the callback right here when when this issue is fixed:
// https://github.com/Leaflet/Leaflet/issues/4484
newM.on('moveend', function() {
var icon = L.divIcon({className: 'marker-icon'})
newM.setIcon(icon);
});

// now, create the polygon coordinate point for that marker
var latlng = newM.getLatLng();
var coords = this._poly._latlngs[0];
Expand Down

0 comments on commit 4a0417d

Please sign in to comment.