mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge pull request #545 from Kamidu/release-3.0.x
improving the location history
This commit is contained in:
commit
3cc2746ef6
@ -31,9 +31,11 @@ function loadLeafletMap() {
|
|||||||
map = L.map(container).setView([locationSets[0].lat, locationSets[0].lng], zoomLevel);
|
map = L.map(container).setView([locationSets[0].lat, locationSets[0].lng], zoomLevel);
|
||||||
L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
|
L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
|
||||||
|
|
||||||
for(var i = 0; i < locationSets.length; i++){
|
var initTime = locations.times[0].time, lastTime = locations.times[locationSets.length - 1].time;
|
||||||
console.log(locationSets[i]);
|
var totalTime = lastTime - initTime;
|
||||||
var m = L.marker(locationSets[i]).addTo(map).bindPopup(new Date(locations.times[i].time).toISOString())
|
for (var i = 0; i < locationSets.length; i++) {
|
||||||
|
var opacVal = (locations.times[i].time - initTime) / totalTime;
|
||||||
|
var m = L.marker(locationSets[i], {"opacity": opacVal}).addTo(map).bindPopup(new Date(locations.times[i].time).toISOString());
|
||||||
m.on('mouseover', function (e) {
|
m.on('mouseover', function (e) {
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
});
|
});
|
||||||
@ -51,7 +53,7 @@ function loadLeafletMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(".location_tab").on("click", function() {
|
$(".location_tab").on("click", function () {
|
||||||
loadLeafletMap();
|
loadLeafletMap();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -20,22 +20,22 @@ var map;
|
|||||||
|
|
||||||
function loadLeafletMap() {
|
function loadLeafletMap() {
|
||||||
var deviceLocationID = "#device-location",
|
var deviceLocationID = "#device-location",
|
||||||
lat = $(deviceLocationID).data("lat"),
|
|
||||||
long = $(deviceLocationID).data("long"),
|
|
||||||
locations = $(deviceLocationID).data("locations"),
|
locations = $(deviceLocationID).data("locations"),
|
||||||
container = "device-location",
|
container = "device-location",
|
||||||
zoomLevel = 13,
|
zoomLevel = 13,
|
||||||
tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
attribution = "© <a href='https://openstreetmap.org/copyright'>OpenStreetMap</a> contributors";
|
attribution = "© <a href='https://openstreetmap.org/copyright'>OpenStreetMap</a> contributors";
|
||||||
|
|
||||||
if (locations) {
|
if (locations) {
|
||||||
|
|
||||||
var locationSets = locations.locations;
|
var locationSets = locations.locations;
|
||||||
map = L.map(container).setView([lat, long], zoomLevel);
|
map = L.map(container).setView([locationSets[0].lat, locationSets[0].lng], zoomLevel);
|
||||||
L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
|
L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
|
||||||
|
|
||||||
for(var i = 0; i < locationSets.length; i++){
|
var initTime = locations.times[0].time, lastTime = locations.times[locationSets.length - 1].time;
|
||||||
var m = L.marker(locationSets[i]).addTo(map).bindPopup(new Date(locations.times[i].time).toISOString())
|
var totalTime = lastTime - initTime;
|
||||||
|
for (var i = 0; i < locationSets.length; i++) {
|
||||||
|
var opacVal = (locations.times[i].time - initTime) / totalTime;
|
||||||
|
var m = L.marker(locationSets[i], {"opacity": opacVal}).addTo(map).bindPopup(new Date(locations.times[i].time).toISOString());
|
||||||
m.on('mouseover', function (e) {
|
m.on('mouseover', function (e) {
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
});
|
});
|
||||||
@ -53,14 +53,7 @@ function loadLeafletMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("a[data-toggle='tab']").on("shown.bs.tab", function() {
|
$(".location_tab").on("click", function () {
|
||||||
var url = $(this).prop("href");
|
loadLeafletMap();
|
||||||
var hash = url.substring(url.indexOf("#") + 1);
|
|
||||||
|
|
||||||
if (hash == "device_location_tab") {
|
|
||||||
if (!map) {
|
|
||||||
loadLeafletMap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Loading…
Reference in New Issue
Block a user