[Time Conductor] Don't update invalid bounds

Don't enforce minimum time span when bounds are invalid;
https://github.com/nasa/openmctweb/issues/325#issuecomment-170755787
This commit is contained in:
Victor Woeltjen 2016-01-11 18:16:07 -08:00
parent 5beb1de805
commit bb993dc94f

View File

@ -185,13 +185,6 @@ define(
function updateOuterStart(t) { function updateOuterStart(t) {
var ngModel = $scope.ngModel; var ngModel = $scope.ngModel;
ngModel.outer.start = t;
ngModel.outer.end = Math.max(
ngModel.outer.start + outerMinimumSpan,
ngModel.outer.end
);
ngModel.inner.start = ngModel.inner.start =
Math.max(ngModel.outer.start, ngModel.inner.start); Math.max(ngModel.outer.start, ngModel.inner.start);
ngModel.inner.end = Math.max( ngModel.inner.end = Math.max(
@ -207,13 +200,6 @@ define(
function updateOuterEnd(t) { function updateOuterEnd(t) {
var ngModel = $scope.ngModel; var ngModel = $scope.ngModel;
ngModel.outer.end = t;
ngModel.outer.start = Math.min(
ngModel.outer.end - outerMinimumSpan,
ngModel.outer.start
);
ngModel.inner.end = ngModel.inner.end =
Math.min(ngModel.outer.end, ngModel.inner.end); Math.min(ngModel.outer.end, ngModel.inner.end);
ngModel.inner.start = Math.min( ngModel.inner.start = Math.min(
@ -233,19 +219,20 @@ define(
} }
function updateBoundsFromForm() { function updateBoundsFromForm() {
$scope.ngModel = $scope.ngModel || {}; var start = $scope.formModel.start,
$scope.ngModel.outer = { end = $scope.formModel.end;
start: $scope.formModel.start, if (end >= start + outerMinimumSpan) {
end: $scope.formModel.end $scope.ngModel = $scope.ngModel || {};
}; $scope.ngModel.outer = { start: start, end: end };
}
} }
function validateStart(startValue) { function validateStart(startValue) {
return startValue <= $scope.ngModel.outer.end - outerMinimumSpan; return startValue <= $scope.formModel.end - outerMinimumSpan;
} }
function validateEnd(endValue) { function validateEnd(endValue) {
return endValue >= $scope.ngModel.outer.start + outerMinimumSpan; return endValue >= $scope.formModel.start + outerMinimumSpan;
} }
$scope.startLeftDrag = startLeftDrag; $scope.startLeftDrag = startLeftDrag;