Skip to content

Commit

Permalink
added initial code for scale saving, but commented out - doesn't work…
Browse files Browse the repository at this point in the history
… well - it zooms in, but need to think on zoom into what timespan. Need to think about it more. Will do it later. #361
  • Loading branch information
pliablepixels committed Nov 8, 2016
1 parent cd1a23b commit 231021c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
10 changes: 9 additions & 1 deletion www/js/DataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ angular.module('zmApp.controllers')
'disableAlarmCheckMontage': false,
'useLocalTimeZone': true,
'fastLogin': true,
'followTimeLine': false
'followTimeLine': false,
'timelineScale': -1,



Expand Down Expand Up @@ -828,6 +829,13 @@ angular.module('zmApp.controllers')
}


if (typeof loginData.timelineScale == 'undefined') {

loginData.timelineScale = -1;

}




if (typeof loginData.monSingleImageQuality == 'undefined') {
Expand Down
53 changes: 52 additions & 1 deletion www/js/TimelineCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,37 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
// console.log ("GROUPS");
timeline.setGroups(groups);

timeline.fit();
if (NVRDataModel.getLogin().timelineScale == -1)

{
// console.log ("SCALE NOT FOUND");

timeline.fit();
}
else
{
timeline.fit();

/*var d = NVRDataModel.getLogin().timelineScale;
console.log ("SCALE FOUND "+d+" SECONDS");
var w = timeline.getWindow();
console.log ("Original s="+w.start+" e="+w.end);
var s = moment.tz(w.end, NVRDataModel.getTimeZoneNow()).subtract(d,'seconds').tz(moment.tz.guess());
//var s = moment(w.start).format("YYYY-MM-DD HH:mm:ss");
//
//var e = moment(w.start).add(d,'seconds').format("YYYY-MM-DD HH:mm:ss");
var e = moment.tz(w.end, NVRDataModel.getTimeZoneNow()).tz(moment.tz.guess());
console.log ("Start="+s+" End="+e);
$timeout (function() {timeline.setWindow(s,e);},1000);*/


}


lastTimeForEvent = moment();
updateInterval = $interval(function() {
Expand Down Expand Up @@ -1120,6 +1150,27 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
});*/

timeline.on('rangechanged', function(s)
{
///console.log ("Range Changed:"+JSON.stringify(s));
if (s.byUser)
{

var w = timeline.getWindow();
//console.log ("start:"+w.start+" end:"+w.end);
var a = moment(w.start);
var b = moment(w.end);
var d = b.diff(a,'seconds');
var ld = NVRDataModel.getLogin();
ld.timelineScale = d;
NVRDataModel.setLogin(ld);
//console.log ("Stored user scale of "+d+" seconds");
}



});

timeline.on('click', function(prop) {


Expand Down

0 comments on commit 231021c

Please sign in to comment.