Commit cb64c860ec882ade05c19815fb3be4f5a82de256
1 parent
968f2745
Update tootlip create marker/polygon
Showing
1 changed file
with
14 additions
and
6 deletions
@@ -127,10 +127,14 @@ export default abstract class LeafletMap { | @@ -127,10 +127,14 @@ export default abstract class LeafletMap { | ||
127 | const newMarker = L.marker(mousePositionOnMap, { icon }).addTo(this.map); | 127 | const newMarker = L.marker(mousePositionOnMap, { icon }).addTo(this.map); |
128 | const datasourcesList = document.createElement('div'); | 128 | const datasourcesList = document.createElement('div'); |
129 | const customLatLng = this.convertToCustomFormat(mousePositionOnMap); | 129 | const customLatLng = this.convertToCustomFormat(mousePositionOnMap); |
130 | + const header = document.createElement('p'); | ||
131 | + header.appendChild(document.createTextNode('Select entity:')); | ||
132 | + header.setAttribute('style', 'font-size: 14px; margin: 8px 0'); | ||
133 | + datasourcesList.append(header); | ||
130 | this.datasources.forEach(ds => { | 134 | this.datasources.forEach(ds => { |
131 | const dsItem = document.createElement('p'); | 135 | const dsItem = document.createElement('p'); |
132 | dsItem.appendChild(document.createTextNode(ds.entityName)); | 136 | dsItem.appendChild(document.createTextNode(ds.entityName)); |
133 | - dsItem.setAttribute('style', 'font-size: 14px'); | 137 | + dsItem.setAttribute('style', 'font-size: 14px; margin: 8px 0; cursor: pointer'); |
134 | dsItem.onclick = () => { | 138 | dsItem.onclick = () => { |
135 | const updatedEnttity = { ...ds, ...customLatLng }; | 139 | const updatedEnttity = { ...ds, ...customLatLng }; |
136 | this.saveMarkerLocation(updatedEnttity).subscribe(() => { | 140 | this.saveMarkerLocation(updatedEnttity).subscribe(() => { |
@@ -141,9 +145,9 @@ export default abstract class LeafletMap { | @@ -141,9 +145,9 @@ export default abstract class LeafletMap { | ||
141 | } | 145 | } |
142 | datasourcesList.append(dsItem); | 146 | datasourcesList.append(dsItem); |
143 | }); | 147 | }); |
148 | + datasourcesList.append(document.createElement('br')); | ||
144 | const deleteBtn = document.createElement('a'); | 149 | const deleteBtn = document.createElement('a'); |
145 | - deleteBtn.appendChild(document.createTextNode('Delete position')); | ||
146 | - deleteBtn.setAttribute('color', 'red'); | 150 | + deleteBtn.appendChild(document.createTextNode('Discard changes')); |
147 | deleteBtn.onclick = () => { | 151 | deleteBtn.onclick = () => { |
148 | this.map.removeLayer(newMarker); | 152 | this.map.removeLayer(newMarker); |
149 | } | 153 | } |
@@ -196,10 +200,14 @@ export default abstract class LeafletMap { | @@ -196,10 +200,14 @@ export default abstract class LeafletMap { | ||
196 | const newPolygon = L.polygon(mousePositionOnMap).addTo(this.map); | 200 | const newPolygon = L.polygon(mousePositionOnMap).addTo(this.map); |
197 | const datasourcesList = document.createElement('div'); | 201 | const datasourcesList = document.createElement('div'); |
198 | const customLatLng = {[this.options.polygonKeyName]: this.convertToPolygonFormat(mousePositionOnMap)}; | 202 | const customLatLng = {[this.options.polygonKeyName]: this.convertToPolygonFormat(mousePositionOnMap)}; |
203 | + const header = document.createElement('p'); | ||
204 | + header.appendChild(document.createTextNode('Select entity:')); | ||
205 | + header.setAttribute('style', 'font-size: 14px; margin: 8px 0'); | ||
206 | + datasourcesList.append(header); | ||
199 | this.datasources.forEach(ds => { | 207 | this.datasources.forEach(ds => { |
200 | const dsItem = document.createElement('p'); | 208 | const dsItem = document.createElement('p'); |
201 | dsItem.appendChild(document.createTextNode(ds.entityName)); | 209 | dsItem.appendChild(document.createTextNode(ds.entityName)); |
202 | - dsItem.setAttribute('style', 'font-size: 14px'); | 210 | + dsItem.setAttribute('style', 'font-size: 14px; margin: 8px 0; cursor: pointer'); |
203 | dsItem.onclick = () => { | 211 | dsItem.onclick = () => { |
204 | const updatedEnttity = { ...ds, ...customLatLng }; | 212 | const updatedEnttity = { ...ds, ...customLatLng }; |
205 | this.savePolygonLocation(updatedEnttity).subscribe(() => { | 213 | this.savePolygonLocation(updatedEnttity).subscribe(() => { |
@@ -209,9 +217,9 @@ export default abstract class LeafletMap { | @@ -209,9 +217,9 @@ export default abstract class LeafletMap { | ||
209 | } | 217 | } |
210 | datasourcesList.append(dsItem); | 218 | datasourcesList.append(dsItem); |
211 | }); | 219 | }); |
220 | + datasourcesList.append(document.createElement('br')); | ||
212 | const deleteBtn = document.createElement('a'); | 221 | const deleteBtn = document.createElement('a'); |
213 | - deleteBtn.appendChild(document.createTextNode('Delete position')); | ||
214 | - deleteBtn.setAttribute('color', 'red'); | 222 | + deleteBtn.appendChild(document.createTextNode('Discard changes')); |
215 | deleteBtn.onclick = () => { | 223 | deleteBtn.onclick = () => { |
216 | this.map.removeLayer(newPolygon); | 224 | this.map.removeLayer(newPolygon); |
217 | } | 225 | } |