mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 01:42:31 +00:00
[Time Conductor] Fixed zoom slider behavior
This commit is contained in:
parent
f5806613b9
commit
49e600dcc9
@ -1,7 +1,7 @@
|
||||
<!-- Parent holder for time conductor. follow-mode | fixed-mode -->
|
||||
<div ng-controller="TimeConductorController as tcController"
|
||||
class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selectedKey}}-mode {{timeSystemModel.selected.metadata.key}}-time-system"
|
||||
ng-class="{'status-panning': panning}">
|
||||
ng-class="{'status-panning': tcController.panning}">
|
||||
|
||||
<div class="flex-elem holder time-conductor-icon">
|
||||
<div class="hand-little"></div>
|
||||
@ -113,13 +113,15 @@
|
||||
}">
|
||||
</mct-control>
|
||||
<!-- Zoom control -->
|
||||
<div class="l-time-conductor-zoom-w grows flex-elem l-flex-row">
|
||||
<div ng-if="tcController.supportsZoom"
|
||||
class="l-time-conductor-zoom-w grows flex-elem l-flex-row">
|
||||
{{currentZoom}}
|
||||
<span
|
||||
class="time-conductor-zoom-current-range flex-elem flex-fixed holder">{{timeUnits}}</span>
|
||||
<input class="time-conductor-zoom flex-elem" type="range"
|
||||
ng-model="currentZoom"
|
||||
ng-mouseUp="tcController.zoomStop(currentZoom)"
|
||||
ng-change="tcController.zoomDrag(currentZoom)"
|
||||
ng-model="tcController.currentZoom"
|
||||
ng-mouseUp="tcController.zoomStop(tcController.currentZoom)"
|
||||
ng-change="tcController.zoomDrag(tcController.currentZoom)"
|
||||
min="0.01"
|
||||
step="0.01"
|
||||
max="0.99" />
|
||||
|
@ -72,8 +72,10 @@ define(
|
||||
//If conductor has a time system selected already, populate the
|
||||
//form from it
|
||||
this.$scope.timeSystemModel = {};
|
||||
if (this.conductor.timeSystem()) {
|
||||
this.setFormFromTimeSystem(this.conductor.timeSystem());
|
||||
var timeSystem = this.conductor.timeSystem();
|
||||
if (timeSystem) {
|
||||
this.setFormFromTimeSystem(timeSystem);
|
||||
this.supportsZoom = timeSystem.defaults().zoom !== undefined;
|
||||
}
|
||||
|
||||
//Represents the various modes, and the currently selected mode
|
||||
@ -114,17 +116,17 @@ define(
|
||||
};
|
||||
|
||||
TimeConductorController.prototype.onPan = function (bounds) {
|
||||
this.$scope.panning = true;
|
||||
this.panning = true;
|
||||
this.$scope.boundsModel.start = bounds.start;
|
||||
this.$scope.boundsModel.end = bounds.end;
|
||||
};
|
||||
|
||||
TimeConductorController.prototype.onPanStop = function () {
|
||||
this.$scope.panning = false;
|
||||
this.panning = false;
|
||||
};
|
||||
|
||||
TimeConductorController.prototype.changeBounds = function (bounds) {
|
||||
if (!this.$scope.zooming && !this.$scope.panning) {
|
||||
if (!this.zooming && !this.panning) {
|
||||
this.setFormFromBounds(bounds);
|
||||
}
|
||||
};
|
||||
@ -136,12 +138,14 @@ define(
|
||||
* @private
|
||||
*/
|
||||
TimeConductorController.prototype.setFormFromBounds = function (bounds) {
|
||||
if (!this.$scope.zooming && ! this.$scope.panning) {
|
||||
if (!this.zooming && ! this.panning) {
|
||||
this.$scope.boundsModel.start = bounds.start;
|
||||
this.$scope.boundsModel.end = bounds.end;
|
||||
|
||||
this.$scope.currentZoom = this.toSliderValue(bounds.end - bounds.start);
|
||||
this.toTimeUnits(bounds.end - bounds.start);
|
||||
if (this.supportsZoom) {
|
||||
this.currentZoom = this.toSliderValue(bounds.end - bounds.start);
|
||||
this.toTimeUnits(bounds.end - bounds.start);
|
||||
}
|
||||
|
||||
if (!this.pendingUpdate) {
|
||||
this.pendingUpdate = true;
|
||||
@ -182,8 +186,10 @@ define(
|
||||
timeSystemModel.selected = timeSystem;
|
||||
timeSystemModel.format = timeSystem.formats()[0];
|
||||
timeSystemModel.deltaFormat = timeSystem.deltaFormat();
|
||||
timeSystemModel.minZoom = timeSystem.defaults().zoom.min;
|
||||
timeSystemModel.maxZoom = timeSystem.defaults().zoom.max;
|
||||
if (this.supportsZoom) {
|
||||
timeSystemModel.minZoom = timeSystem.defaults().zoom.min;
|
||||
timeSystemModel.maxZoom = timeSystem.defaults().zoom.max;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -265,6 +271,8 @@ define(
|
||||
|
||||
this.setFormFromDeltas(deltas);
|
||||
this.setFormFromBounds(bounds);
|
||||
|
||||
this.supportsZoom = newTimeSystem.defaults().zoom !== undefined;
|
||||
}
|
||||
this.setFormFromTimeSystem(newTimeSystem);
|
||||
}
|
||||
@ -300,15 +308,13 @@ define(
|
||||
if (zoom.deltas) {
|
||||
this.setFormFromDeltas(zoom.deltas);
|
||||
}
|
||||
|
||||
this.$scope.zooming = true;
|
||||
};
|
||||
|
||||
TimeConductorController.prototype.zoomStop = function () {
|
||||
this.updateBoundsFromForm(this.$scope.boundsModel);
|
||||
this.updateDeltasFromForm(this.$scope.boundsModel);
|
||||
this.zooming = false;
|
||||
|
||||
this.$scope.zooming = false;
|
||||
this.conductorViewService.emit('zoom-stop');
|
||||
};
|
||||
|
||||
|
@ -597,6 +597,10 @@ define(
|
||||
return rowsToFilter.filter(matchRow.bind(null, filters));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param displayRowIndex {number} The index in the displayed rows
|
||||
* to scroll to.
|
||||
*/
|
||||
MCTTableController.prototype.scrollToRow = function (displayRowIndex) {
|
||||
|
||||
var visible = displayRowIndex > this.firstVisible() && displayRowIndex < this.lastVisible();
|
||||
@ -639,6 +643,9 @@ define(
|
||||
this.setTimeOfInterest(this.conductor.timeOfInterest());
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
MCTTableController.prototype.onRowClick = function (event, rowIndex) {
|
||||
if (this.$scope.timeColumns.indexOf(this.$scope.sortColumn) !== -1) {
|
||||
var selectedTime = this.$scope.displayRows[rowIndex][this.$scope.sortColumn].text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user