Skip to content

Commit

Permalink
Merge pull request #15 from RyanBirtch-aot/marker-image-bug
Browse files Browse the repository at this point in the history
Added fix for marker drag
  • Loading branch information
abhilash-aot authored Aug 7, 2024
2 parents 47b8da9 + 8c436e2 commit 876b622
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/src/components/Map/services/MapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ class MapService {
options.onDrawnItemsChange(drawnItems.getLayers());
});

map.on(L.Draw.Event.DRAWSTART, (e) => {
e.layer.setIcon(this.customMarker);
}
map.on('resize', () => {
map.invalidateSize();

});
}
}
Expand Down Expand Up @@ -95,7 +99,6 @@ class MapService {

// Initialize Draw Layer
let drawnItems = new L.FeatureGroup();
//({ iconUrl: '../common/marker-icon.png/' });

map.addLayer(drawnItems);

Expand Down Expand Up @@ -172,7 +175,7 @@ class MapService {
items.forEach((item) => {
let layer;
if (item.type === 'marker') {
layer = L.marker(item.coordinates).setIcon(this.customMarker); //layer.setIcon(this.customMarker);
layer = L.marker(item.coordinates).setIcon(this.customMarker);
} else if (item.type === 'rectangle') {
layer = L.rectangle(item.bounds);
} else if (item.type === 'circle') {
Expand Down

0 comments on commit 876b622

Please sign in to comment.