mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 21:58:13 +00:00
Merge pull request #475 from nasa/open325b
[Time Conductor] Update validation logic
This commit is contained in:
@ -43,7 +43,7 @@ define(
|
||||
function TimeRangeController($scope, formatService, defaultFormat, now) {
|
||||
var tickCount = 2,
|
||||
innerMinimumSpan = 1000, // 1 second
|
||||
outerMinimumSpan = 1000 * 60 * 60, // 1 hour
|
||||
outerMinimumSpan = 1000, // 1 second
|
||||
initialDragValue,
|
||||
formatter = formatService.getFormat(defaultFormat);
|
||||
|
||||
@ -185,13 +185,6 @@ define(
|
||||
function updateOuterStart(t) {
|
||||
var ngModel = $scope.ngModel;
|
||||
|
||||
ngModel.outer.start = t;
|
||||
|
||||
ngModel.outer.end = Math.max(
|
||||
ngModel.outer.start + outerMinimumSpan,
|
||||
ngModel.outer.end
|
||||
);
|
||||
|
||||
ngModel.inner.start =
|
||||
Math.max(ngModel.outer.start, ngModel.inner.start);
|
||||
ngModel.inner.end = Math.max(
|
||||
@ -207,13 +200,6 @@ define(
|
||||
function updateOuterEnd(t) {
|
||||
var ngModel = $scope.ngModel;
|
||||
|
||||
ngModel.outer.end = t;
|
||||
|
||||
ngModel.outer.start = Math.min(
|
||||
ngModel.outer.end - outerMinimumSpan,
|
||||
ngModel.outer.start
|
||||
);
|
||||
|
||||
ngModel.inner.end =
|
||||
Math.min(ngModel.outer.end, ngModel.inner.end);
|
||||
ngModel.inner.start = Math.min(
|
||||
@ -233,11 +219,20 @@ define(
|
||||
}
|
||||
|
||||
function updateBoundsFromForm() {
|
||||
$scope.ngModel = $scope.ngModel || {};
|
||||
$scope.ngModel.outer = {
|
||||
start: $scope.formModel.start,
|
||||
end: $scope.formModel.end
|
||||
};
|
||||
var start = $scope.formModel.start,
|
||||
end = $scope.formModel.end;
|
||||
if (end >= start + outerMinimumSpan) {
|
||||
$scope.ngModel = $scope.ngModel || {};
|
||||
$scope.ngModel.outer = { start: start, end: end };
|
||||
}
|
||||
}
|
||||
|
||||
function validateStart(startValue) {
|
||||
return startValue <= $scope.formModel.end - outerMinimumSpan;
|
||||
}
|
||||
|
||||
function validateEnd(endValue) {
|
||||
return endValue >= $scope.formModel.start + outerMinimumSpan;
|
||||
}
|
||||
|
||||
$scope.startLeftDrag = startLeftDrag;
|
||||
@ -249,6 +244,9 @@ define(
|
||||
|
||||
$scope.updateBoundsFromForm = updateBoundsFromForm;
|
||||
|
||||
$scope.validateStart = validateStart;
|
||||
$scope.validateEnd = validateEnd;
|
||||
|
||||
$scope.ticks = [];
|
||||
|
||||
// Initialize scope to defaults
|
||||
|
Reference in New Issue
Block a user