Skip to content

Commit

Permalink
#997 Manually apply simplified scrollTo
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Oct 20, 2020
1 parent 53f673e commit 8560e4d
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions www/js/EventCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8560e4d

Please sign in to comment.