mirror of https://github.com/MISP/misp-dashboard
Added direct zoom in live dashboard
parent
9f942ded9c
commit
4bff4880aa
|
@ -198,26 +198,6 @@ $(document).ready(function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#rotation_wait_time_selector" ).change(function() {
|
|
||||||
var sel = parseInt($( this ).val());
|
|
||||||
if(isNaN(sel)) {
|
|
||||||
rotation_wait_time = 0;
|
|
||||||
} else {
|
|
||||||
rotation_wait_time = sel;
|
|
||||||
}
|
|
||||||
var old = ROTATIONWAITTIME;
|
|
||||||
ROTATIONWAITTIME = 1000*rotation_wait_time; //seconds
|
|
||||||
if(old == 0) {
|
|
||||||
mapEventManager._timeoutRotate = setTimeout(function(){ mapEventManager.rotateMap(); }, ROTATIONWAITTIME);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$( "#zoom_selector" ).change(function() {
|
|
||||||
var sel = parseInt($( this ).val());
|
|
||||||
zoomlevel = sel;
|
|
||||||
ZOOMLEVEL = sel;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class MapEvent {
|
||||||
class MapEventManager {
|
class MapEventManager {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._mapEventArray = [];
|
this._mapEventArray = [];
|
||||||
|
this._currentMapEvent;
|
||||||
this._nextEventToShow = 0;
|
this._nextEventToShow = 0;
|
||||||
this._first_map = true;
|
this._first_map = true;
|
||||||
this._coordSet = new Set();
|
this._coordSet = new Set();
|
||||||
|
@ -75,9 +76,14 @@ class MapEventManager {
|
||||||
getNextEventToShow() {
|
getNextEventToShow() {
|
||||||
var toShow = this._mapEventArray[this._nextEventToShow];
|
var toShow = this._mapEventArray[this._nextEventToShow];
|
||||||
this._nextEventToShow = this._nextEventToShow == this._mapEventArray.length-1 ? 0 : this._nextEventToShow+1;
|
this._nextEventToShow = this._nextEventToShow == this._mapEventArray.length-1 ? 0 : this._nextEventToShow+1;
|
||||||
|
this._currentMapEvent = toShow;
|
||||||
return toShow;
|
return toShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCurrentMapEvent() {
|
||||||
|
return this._currentMapEvent;
|
||||||
|
}
|
||||||
|
|
||||||
// Perform the roration of the map in the openStreetMap pannel
|
// Perform the roration of the map in the openStreetMap pannel
|
||||||
rotateMap(mapEvent) {
|
rotateMap(mapEvent) {
|
||||||
clearTimeout(this._timeoutRotate); //cancel current map rotation
|
clearTimeout(this._timeoutRotate); //cancel current map rotation
|
||||||
|
@ -96,6 +102,12 @@ class MapEventManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
directZoom() {
|
||||||
|
var mapEvent = this.getCurrentMapEvent();
|
||||||
|
if (mapEvent != undefined)
|
||||||
|
myOpenStreetMap.flyTo([mapEvent.coord.lat, mapEvent.coord.lon], ZOOMLEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
ping() {
|
ping() {
|
||||||
var pnts = openStreetMapObj.latLngToPoint(this._latToPing, this._lonToPing);
|
var pnts = openStreetMapObj.latLngToPoint(this._latToPing, this._lonToPing);
|
||||||
if (pnts != false) { //sometimes latLngToPoint return false
|
if (pnts != false) { //sometimes latLngToPoint return false
|
||||||
|
@ -206,3 +218,26 @@ function connect_source_map() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
connect_source_map()
|
connect_source_map()
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$( "#rotation_wait_time_selector" ).change(function() {
|
||||||
|
var sel = parseInt($( this ).val());
|
||||||
|
if(isNaN(sel)) {
|
||||||
|
rotation_wait_time = 0;
|
||||||
|
} else {
|
||||||
|
rotation_wait_time = sel;
|
||||||
|
}
|
||||||
|
var old = ROTATIONWAITTIME;
|
||||||
|
ROTATIONWAITTIME = 1000*rotation_wait_time; //seconds
|
||||||
|
if(old == 0) {
|
||||||
|
mapEventManager._timeoutRotate = setTimeout(function(){ mapEventManager.rotateMap(); }, ROTATIONWAITTIME);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$( "#zoom_selector" ).change(function() {
|
||||||
|
var sel = parseInt($( this ).val());
|
||||||
|
ZOOMLEVEL = sel;
|
||||||
|
mapEventManager.directZoom();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue