summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/js/EventCtrl.js25
1 files changed, 6 insertions, 19 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index b152925d..2fc4e024 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -108,25 +108,12 @@ angular.module('zmApp.controllers')
});
function scrollTo(eventNum, eventPos) {
- var eventHeightCounter = 0;
- var i = 0;
- var lastEventHeight = 0;
- //loop until we pass the event...
- for (i = 0; i < $scope.events.length; i++) {
- lastEventHeight = getRowHeight($scope.events[i]);
- if ( i >= eventNum ) {
- //$scope.navTitle = ($scope.events[i].Event.humanizeTime); // we don't need to update the navTitle as we're staying in the same place
- break;
- }
- //console.log(getRowHeight($scope.events[i]));
- eventHeightCounter = eventHeightCounter + lastEventHeight;
- }
- var scrl = eventHeightCounter + (lastEventHeight * eventPos);
- //console.log("eventHeightCounter: " + eventHeightCounter + " lastEventHeight: " + lastEventHeight + ", scrl To " + scrl + ", len: " + $scope.events.length);
- NVR.debug("scrollTo: " + scrl);
- $ionicScrollDelegate.$getByHandle("mainScroll").scrollTo(0, scrl, false);
- }
-
+ var scrl = (eventRowHeight * eventNum) + (eventRowHeight * eventPos);
+ //console.log("eventNum: " + eventNum + " eventPos: " + eventPos + ", scrl To " + scrl);
+ //NVR.debug("scrollTo: " + scrl);
+ $ionicScrollDelegate.$getByHandle("mainScroll").scrollTo(0, scrl, false);
+ }
+
function getRowHeight(event) {
var scrubHeight = 274;
return event.Event.ShowScrub ? eventRowHeight + scrubHeight : eventRowHeight;