Skip to content

Commit

Permalink
Started work on feature to resolve pR0Ps#18
Browse files Browse the repository at this point in the history
  • Loading branch information
RmStorm committed Oct 18, 2019
1 parent eabbf5a commit d23ea0a
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/trackmap_ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,27 @@ export class TrackMapCtrl extends MetricsPanelCtrl {
idx--;
}
this.hoverMarker.setLatLng(this.coords[idx].position);

if (this.leafMap.hasLayer(this.time_stamp_tool_tip) || this.leafMap.hasLayer(this.coordinate_tool_tip)) {
// TODO: Remove bullet points from list
let info = document.createElement('ul')

let time = document.createElement('li')
let lat = document.createElement('li')
let lon = document.createElement('li')
if (this.leafMap.hasLayer(this.time_stamp_tool_tip)) {
// TODO: fix timestamp to correspond to grafana
time.innerHTML += `Timestamp : ${new Date(this.coords[idx].timestamp).toISOString()}`
info.appendChild(time)
}
if (this.leafMap.hasLayer(this.coordinate_tool_tip)) {
lat.innerHTML += `Latitude : ${this.coords[idx].position.lat}`
lon.innerHTML += `Longitude : ${this.coords[idx].position.lng}`
info.appendChild(lat)
info.appendChild(lon)
}
this.hoverMarker.bindTooltip(info).openTooltip();
}
}

onPanelClear(evt) {
Expand Down Expand Up @@ -208,8 +229,11 @@ export class TrackMapCtrl extends MetricsPanelCtrl {
zoomDelta: 1,
});

this.time_stamp_tool_tip = L.layerGroup([]);
this.coordinate_tool_tip = L.layerGroup([]);
this.ToolTipLayers = {"Timestamp": this.time_stamp_tool_tip, "Coordinates": this.coordinate_tool_tip}
// Add layers to the control widget
L.control.layers(this.layers).addTo(this.leafMap);
L.control.layers(this.layers, this.ToolTipLayers).addTo(this.leafMap);

// Add default layer to map
this.layers[this.panel.defaultLayer].addTo(this.leafMap);
Expand Down

0 comments on commit d23ea0a

Please sign in to comment.