mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 15:10:50 +00:00
Merge remote-tracking branch 'origin/timeline-flash-997'
This commit is contained in:
commit
4c097faf88
@ -472,7 +472,7 @@ define([
|
|||||||
"implementation": TimelineZoomController,
|
"implementation": TimelineZoomController,
|
||||||
"depends": [
|
"depends": [
|
||||||
"$scope",
|
"$scope",
|
||||||
"$timeout",
|
"$window",
|
||||||
"TIMELINE_ZOOM_CONFIGURATION"
|
"TIMELINE_ZOOM_CONFIGURATION"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ define(
|
|||||||
* Controls the pan-zoom state of a timeline view.
|
* Controls the pan-zoom state of a timeline view.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TimelineZoomController($scope, $timeout, ZOOM_CONFIGURATION) {
|
function TimelineZoomController($scope, $window, ZOOM_CONFIGURATION) {
|
||||||
// Prefer to start with the middle index
|
// Prefer to start with the middle index
|
||||||
var zoomLevels = ZOOM_CONFIGURATION.levels || [1000],
|
var zoomLevels = ZOOM_CONFIGURATION.levels || [1000],
|
||||||
zoomIndex = Math.floor(zoomLevels.length / 2),
|
zoomIndex = Math.floor(zoomLevels.length / 2),
|
||||||
@ -54,9 +54,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setScroll(x) {
|
function setScroll(x) {
|
||||||
$timeout(function () {
|
$window.requestAnimationFrame(function () {
|
||||||
$scope.scroll.x = x;
|
$scope.scroll.x = x;
|
||||||
}, 0);
|
$scope.$apply();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeZoomFromTimespan(timespan) {
|
function initializeZoomFromTimespan(timespan) {
|
||||||
|
@ -28,7 +28,7 @@ define(
|
|||||||
describe("The timeline zoom state controller", function () {
|
describe("The timeline zoom state controller", function () {
|
||||||
var testConfiguration,
|
var testConfiguration,
|
||||||
mockScope,
|
mockScope,
|
||||||
mockTimeout,
|
mockWindow,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -36,13 +36,16 @@ define(
|
|||||||
levels: [1000, 2000, 3500],
|
levels: [1000, 2000, 3500],
|
||||||
width: 12321
|
width: 12321
|
||||||
};
|
};
|
||||||
mockScope = jasmine.createSpyObj("$scope", ['$watch']);
|
mockScope =
|
||||||
|
jasmine.createSpyObj("$scope", ['$watch', '$apply']);
|
||||||
mockScope.commit = jasmine.createSpy('commit');
|
mockScope.commit = jasmine.createSpy('commit');
|
||||||
mockScope.scroll = { x: 0, width: 1000 };
|
mockScope.scroll = { x: 0, width: 1000 };
|
||||||
mockTimeout = jasmine.createSpy('$timeout');
|
mockWindow = {
|
||||||
|
requestAnimationFrame: jasmine.createSpy('raf')
|
||||||
|
};
|
||||||
controller = new TimelineZoomController(
|
controller = new TimelineZoomController(
|
||||||
mockScope,
|
mockScope,
|
||||||
mockTimeout,
|
mockWindow,
|
||||||
testConfiguration
|
testConfiguration
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -109,7 +112,7 @@ define(
|
|||||||
call.args[1](mockScope[call.args[0]]);
|
call.args[1](mockScope[call.args[0]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
mockTimeout.calls.forEach(function (call) {
|
mockWindow.requestAnimationFrame.calls.forEach(function (call) {
|
||||||
call.args[0]();
|
call.args[0]();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user