[Time Controller] Only listen for display-bounds changes

...from plot. WTD-1515
This commit is contained in:
Victor Woeltjen
2015-09-11 11:31:12 -07:00
parent 62962e119e
commit 2a14cf2dfc

View File

@ -66,6 +66,7 @@ define(
cachedObjects = [], cachedObjects = [],
updater, updater,
lastBounds, lastBounds,
throttledRequery,
handle; handle;
// Populate the scope with axis information (specifically, options // Populate the scope with axis information (specifically, options
@ -96,7 +97,7 @@ define(
} }
// Change the displayable bounds // Change the displayable bounds
function setBasePanZoom(unused, bounds) { function setBasePanZoom(bounds) {
var start = bounds.start, var start = bounds.start,
end = bounds.end; end = bounds.end;
if (updater) { if (updater) {
@ -121,7 +122,7 @@ define(
); );
// Keep any externally-provided bounds // Keep any externally-provided bounds
if (lastBounds) { if (lastBounds) {
setBasePanZoom({}, lastBounds); setBasePanZoom(lastBounds);
} }
} }
@ -181,14 +182,17 @@ define(
} }
} }
// Initiate a new query for data because query bounds changed // Respond to a display bounds change (requery for data)
function requery() { function changeDisplayBounds(event, bounds) {
setBasePanZoom(bounds);
if (handle) { if (handle) {
recreateUpdater(); recreateUpdater();
requestTelemetry(); throttledRequery();
} }
} }
throttledRequery = throttle(requestTelemetry, 250);
this.modeOptions = new PlotModeOptions([], subPlotFactory); this.modeOptions = new PlotModeOptions([], subPlotFactory);
this.updateValues = updateValues; this.updateValues = updateValues;
@ -202,10 +206,7 @@ define(
$scope.$watch('domainObject', subscribe); $scope.$watch('domainObject', subscribe);
// Respond to external bounds changes // Respond to external bounds changes
$scope.$on("telemetry:display:bounds", setBasePanZoom); $scope.$on("telemetry:display:bounds", changeDisplayBounds);
// Respond to external query range changes
$scope.$on("telemetry:query:bounds", throttle(requery, 250));
// Unsubscribe when the plot is destroyed // Unsubscribe when the plot is destroyed
$scope.$on("$destroy", releaseSubscription); $scope.$on("$destroy", releaseSubscription);