mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
[Time Conductor] Enforce minimum outer span
This commit is contained in:
@ -34,7 +34,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
function TimeConductorController($scope, now) {
|
function TimeConductorController($scope, now) {
|
||||||
var tickCount = 2,
|
var tickCount = 2,
|
||||||
innerMinimum = 1000, // 1 second
|
innerMinimumSpan = 1000, // 1 second
|
||||||
|
outerMinimumSpan = 1000 * 60 * 60, // 1 hour
|
||||||
initialDragValue;
|
initialDragValue;
|
||||||
|
|
||||||
function formatTimestamp(ts) {
|
function formatTimestamp(ts) {
|
||||||
@ -140,7 +141,7 @@ define(
|
|||||||
$scope.ngModel.inner.start = clamp(
|
$scope.ngModel.inner.start = clamp(
|
||||||
initialDragValue + delta,
|
initialDragValue + delta,
|
||||||
$scope.ngModel.outer.start,
|
$scope.ngModel.outer.start,
|
||||||
$scope.ngModel.inner.end - innerMinimum
|
$scope.ngModel.inner.end - innerMinimumSpan
|
||||||
);
|
);
|
||||||
updateViewFromModel($scope.ngModel);
|
updateViewFromModel($scope.ngModel);
|
||||||
}
|
}
|
||||||
@ -149,7 +150,7 @@ define(
|
|||||||
var delta = toMillis(pixels);
|
var delta = toMillis(pixels);
|
||||||
$scope.ngModel.inner.end = clamp(
|
$scope.ngModel.inner.end = clamp(
|
||||||
initialDragValue + delta,
|
initialDragValue + delta,
|
||||||
$scope.ngModel.inner.start + innerMinimum,
|
$scope.ngModel.inner.start + innerMinimumSpan,
|
||||||
$scope.ngModel.outer.end
|
$scope.ngModel.outer.end
|
||||||
);
|
);
|
||||||
updateViewFromModel($scope.ngModel);
|
updateViewFromModel($scope.ngModel);
|
||||||
@ -175,8 +176,12 @@ define(
|
|||||||
|
|
||||||
function updateOuterStart(t) {
|
function updateOuterStart(t) {
|
||||||
var ngModel = $scope.ngModel;
|
var ngModel = $scope.ngModel;
|
||||||
ngModel.outer.end =
|
|
||||||
Math.max(ngModel.outer.start, ngModel.outer.end);
|
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 =
|
ngModel.inner.end =
|
||||||
@ -189,8 +194,12 @@ define(
|
|||||||
|
|
||||||
function updateOuterEnd(t) {
|
function updateOuterEnd(t) {
|
||||||
var ngModel = $scope.ngModel;
|
var ngModel = $scope.ngModel;
|
||||||
ngModel.outer.start =
|
|
||||||
Math.min(ngModel.outer.end, ngModel.outer.start);
|
ngModel.outer.start = Math.min(
|
||||||
|
ngModel.outer.end - outerMinimumSpan,
|
||||||
|
ngModel.outer.start
|
||||||
|
);
|
||||||
|
|
||||||
ngModel.inner.start =
|
ngModel.inner.start =
|
||||||
Math.min(ngModel.outer.end, ngModel.inner.start);
|
Math.min(ngModel.outer.end, ngModel.inner.start);
|
||||||
ngModel.inner.end =
|
ngModel.inner.end =
|
||||||
|
Reference in New Issue
Block a user