Added rotation speed selector

pull/18/head
Sami Mokaddem 2017-10-23 16:34:14 +02:00
parent 220e0985d5
commit 2b6e696548
3 changed files with 30 additions and 10 deletions

View File

@ -124,6 +124,20 @@ $(document).ready(function () {
console.log("No event source_log");
}
});
$( "#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);
}
});
});

View File

@ -1,10 +1,10 @@
const MAXNUMCOORD = 100;
const PINGWAITTIME = 1000*1; //1s
const MAXIMGROTATION = max_img_rotation;
const ROTATIONWAITTIME = 1000*rotation_wait_time; //seconds
const OSMURL='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const OSMATTRIB='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var ROTATIONWAITTIME = 1000*rotation_wait_time; //seconds
var myOpenStreetMap = L.map('feedDivMap1').setView([0, 0], 1);
var osm = new L.TileLayer(OSMURL, {minZoom: 0, maxZoom: 17}).addTo(myOpenStreetMap);
@ -87,7 +87,10 @@ class MapEventManager {
mapEvent.marker.bindPopup(mapEvent.textMarker).openPopup();
$("#textMap1").fadeOut(400, function(){ $(this).text(mapEvent.text); }).fadeIn(400);
this._timeoutRotate = setTimeout(function(){ mapEventManager.rotateMap(); }, ROTATIONWAITTIME);
if(ROTATIONWAITTIME != 0) {
console.log(ROTATIONWAITTIME);
this._timeoutRotate = setTimeout(function(){ mapEventManager.rotateMap(); }, ROTATIONWAITTIME);
}
}
ping() {

View File

@ -78,14 +78,17 @@ small {
<div class="col-lg-5">
<div class="panel panel-default" style="margin-top: 15px; height: 68vh;">
<!--<div class="panel-heading">
<i class="fa fa-bar-chart-o fa-fw"></i> Statistics
</div>-->
<!--<div id="panelbody" class="panel-body" style="height: 37vh; width:100%;">
<div id="feedDiv1A" style="width:50%; height: calc(100% - 30px); position: relative; float: left;"></div>
<div id="feedDiv1B" style="width:50%; height: calc(100% - 30px); position: relative; float: left;"></div>-->
<div id="textMap1" class="panel-heading bg-info" style="font-weight: bold;"> No map
<i class="fa fa-bar-chart-o fa-fw"></i>
<div class="panel-heading bg-info" style="font-weight: bold;">
<b id="textMap1"> No map </b>
<div style="float: right;">
<i id="txtMapNum">1</i><i>/{{ max_img_rotation }}</i>
<select id="rotation_wait_time_selector" style="margin-top: -7px;">
<option value="∞" selected>No rotation</option>
<option value="{{ rotation_wait_time }}" selected>{{ rotation_wait_time }}sec</option>
<option value="{{ rotation_wait_time * 2 }}">{{ rotation_wait_time * 2 }}sec</option>
<option value="{{ rotation_wait_time * 5}}">{{ rotation_wait_time * 5 }}sec</option>
</select>
</div>
</div>
<div id="panelbody" class="panel-body" style="height: 93%; padding: 5px">
<div id="feedDivMap1" style="width:100%; height: 100%;">