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 {
|
||||
constructor() {
|
||||
this._mapEventArray = [];
|
||||
this._currentMapEvent;
|
||||
this._nextEventToShow = 0;
|
||||
this._first_map = true;
|
||||
this._coordSet = new Set();
|
||||
|
@ -75,9 +76,14 @@ class MapEventManager {
|
|||
getNextEventToShow() {
|
||||
var toShow = this._mapEventArray[this._nextEventToShow];
|
||||
this._nextEventToShow = this._nextEventToShow == this._mapEventArray.length-1 ? 0 : this._nextEventToShow+1;
|
||||
this._currentMapEvent = toShow;
|
||||
return toShow;
|
||||
}
|
||||
|
||||
getCurrentMapEvent() {
|
||||
return this._currentMapEvent;
|
||||
}
|
||||
|
||||
// Perform the roration of the map in the openStreetMap pannel
|
||||
rotateMap(mapEvent) {
|
||||
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() {
|
||||
var pnts = openStreetMapObj.latLngToPoint(this._latToPing, this._lonToPing);
|
||||
if (pnts != false) { //sometimes latLngToPoint return false
|
||||
|
@ -206,3 +218,26 @@ function 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