Commit 1cf49faebc25a3944276aee51a38cabae259b595
1 parent
dc0572f8
Fixed icon show marker in edit mode map into production build
Showing
2 changed files
with
14 additions
and
5 deletions
... | ... | @@ -28,7 +28,10 @@ |
28 | 28 | { "glob": "worker-html.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" }, |
29 | 29 | { "glob": "worker-css.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" }, |
30 | 30 | { "glob": "worker-json.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" }, |
31 | - { "glob": "worker-javascript.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" } | |
31 | + { "glob": "worker-javascript.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" }, | |
32 | + { "glob": "marker-icon-2x.png", "input": "node_modules/leaflet/dist/images/", "output": "/" }, | |
33 | + { "glob": "marker-icon.png", "input": "node_modules/leaflet/dist/images/", "output": "/" }, | |
34 | + { "glob": "marker-shadow.png", "input": "node_modules/leaflet/dist/images/", "output": "/" } | |
32 | 35 | ], |
33 | 36 | "styles": [ |
34 | 37 | "src/styles.scss", | ... | ... |
... | ... | @@ -122,8 +122,16 @@ export default abstract class LeafletMap { |
122 | 122 | }); |
123 | 123 | const dragListener = (e: L.DragEndEvent) => { |
124 | 124 | if (e.type === 'dragend' && mousePositionOnMap) { |
125 | - const icon = new L.Icon.Default(); | |
126 | - icon.options.shadowSize = [0, 0]; | |
125 | + const icon = L.icon({ | |
126 | + iconRetinaUrl: 'marker-icon-2x.png', | |
127 | + iconUrl: 'marker-icon.png', | |
128 | + shadowUrl: 'marker-shadow.png', | |
129 | + iconSize: [25, 41], | |
130 | + iconAnchor: [12, 41], | |
131 | + popupAnchor: [1, -34], | |
132 | + tooltipAnchor: [16, -28], | |
133 | + shadowSize: [41, 41] | |
134 | + }); | |
127 | 135 | const newMarker = L.marker(mousePositionOnMap, { icon }).addTo(this.map); |
128 | 136 | const datasourcesList = document.createElement('div'); |
129 | 137 | const customLatLng = this.convertToCustomFormat(mousePositionOnMap); |
... | ... | @@ -195,8 +203,6 @@ export default abstract class LeafletMap { |
195 | 203 | }); |
196 | 204 | const dragListener = (e: L.DragEndEvent) => { |
197 | 205 | if (e.type === 'dragend' && mousePositionOnMap) { |
198 | - const icon = new L.Icon.Default(); | |
199 | - icon.options.shadowSize = [0, 0]; | |
200 | 206 | const newPolygon = L.polygon(mousePositionOnMap).addTo(this.map); |
201 | 207 | const datasourcesList = document.createElement('div'); |
202 | 208 | const customLatLng = {[this.options.polygonKeyName]: this.convertToPolygonFormat(mousePositionOnMap)}; | ... | ... |