Skip to content

Commit

Permalink
#1067 handle hide/unhide option
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed May 31, 2021
1 parent 085fd8e commit 44006a4
Showing 1 changed file with 39 additions and 38 deletions.
77 changes: 39 additions & 38 deletions www/js/MontageCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ angular.module('zmApp.controllers')
$scope.cancelReorder = function () {
$scope.modal.remove();
$timeout ( function () {
finishReorder();
finishReorder(true);
},300);

};
Expand All @@ -836,20 +836,13 @@ angular.module('zmApp.controllers')
$scope.currentZMGroupName='';
var ld = NVR.getLogin();
ld.currentZMGroupName = '';
//ld.packeryPositions = undefined;
// NVR.debug("clearing positions");


NVR.setLogin(ld);
$scope.modal.remove();
$scope.MontageMonitors = $scope.copyMontage;
//console.log ($scope.copyMontage);
// call finish reorder after modal is gone
$timeout ( function () {
finishReorder();
},300);

};

function finishReorder() {

currentStreamState = streamState.STOPPED;

for (var i=0; i < $scope.MontageMonitors.length; i++) {
var display= $scope.MontageMonitors[i].Monitor.listDisplay;
Expand All @@ -862,40 +855,46 @@ angular.module('zmApp.controllers')
} // before reorder array
} // montage monitors

//console.log ($scope.copyMontage);
// call finish reorder after modal is gone
ld.packeryPositions = undefined;
NVR.debug ('Updating positions:'+JSON.stringify(ld.packeryPositions));
//console.log ("Savtogging " + ld.packeryPositions);
//ld.currentMontageProfile = "__reorder__";
$scope.currentProfileName = $translate.instant('kMontage');
$timeout ( function () {
NVR.setLogin(ld)
.then (function() {
finishReorder(false);
});
},300);

};

function finishReorder(match_reorder) {

currentStreamState = streamState.STOPPED;


//console.log ("AFTER REORDER="+JSON.stringify(beforeReorderPositions));

for (var n = 0; i < $scope.MontageMonitors.length; i++) {
$scope.MontageMonitors[n].Monitor.connKey = NVR.regenConnKeys($scope.MontageMonitors[i]);
}

var ld = NVR.getLogin();
ld.packeryPositions = JSON.stringify(beforeReorderPositions);
//console.log ("Savtogging " + ld.packeryPositions);
ld.currentMontageProfile = "";
$scope.currentProfileName = $translate.instant('kMontage');
NVR.setLogin(ld)
.then (function () {
if (match_reorder) {
var ps = NVR.getLogin().packeryPositions;
var p = parsePositions(ps);
console.log ('HEY!!!!');
matchMonitorsToPositions(p);
initPackery();
//$ionicScrollDelegate.$getByHandle("montage-delegate").scrollTop();
//NVR.reloadMonitorDisplayStatus();
//$scope.areImagesLoading = false;
//currentStreamState = streamState.SNAPSHOT;
/*
if (simulStreaming) {
} else {
NVR.debug ('Not calling matchReorder');
}

$timeout(function () {
NVR.debug("Switching mode to active...");
currentStreamState = streamState.ACTIVE;
}, 100);
}
}, 20);*/
},
function (err) {
NVR.log ('ERROR:'+JSON.stringify(err));
});

initPackery();
// ld.packeryPositions = JSON.stringify(beforeReorderPositions);

}


Expand Down Expand Up @@ -1113,12 +1112,12 @@ angular.module('zmApp.controllers')
});


/*

$timeout ( function () {
beforeReorderPositions = pckry.getShiftPositions('data-item-id');
finishReorder();
},300);
*/

} else {
NVR.debug ("No action taken as selection is same as current");
}
Expand Down Expand Up @@ -2356,13 +2355,15 @@ angular.module('zmApp.controllers')

console.log ("matchMonitor positions:"+JSON.stringify(positions));
if (!mon) { mon = $scope.MontageMonitors;}
if (!mon) { return;}
var disabled_display;
// hide disabled monitors when no profile is used
if (!ld.currentMontageProfile || ld.currentMontageProfile == $translate.instant('kMontageDefaultProfile')) {
disabled_display = 'noshow';
} else {
disabled_display = 'blank';
}

NVR.debug ('We are in profile:'+ld.currentMontageProfile+" so disabled monitors is "+disabled_display);
NVR.debug ('Passed profile is: '+JSON.stringify(positions));
if (!positions.length) layouttype = true;
Expand Down

0 comments on commit 44006a4

Please sign in to comment.