Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dadca62

Browse files
committedOct 17, 2016
Positioning of TOI in tables and plots
1 parent 7a09bc1 commit dadca62

File tree

8 files changed

+67
-28
lines changed

8 files changed

+67
-28
lines changed
 

‎platform/features/conductor-v2/conductor/res/sass/_time-of-interest.scss

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
}
141141
}
142142

143-
144143
// TOI is showing value as well
145144
.show-val .l-toi-holder {
146145
.l-toi {

‎platform/features/conductor-v2/conductor/res/templates/time-conductor.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@
9090
<a class="l-page-button s-icon-button icon-pointer-left"></a>
9191
<div class="l-data-visualization">
9292
<div style="position: relative; height: 100%" ng-style="{'left': toi.left + '%'}">
93-
<mct-include key="'time-of-interest'" class="show-val"
94-
parameters = "{'name': 'conductor'}"></mct-include>
93+
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
9594
</div>
9695
</div>
9796
<a class="l-page-button align-right s-icon-button icon-pointer-right"></a>

‎platform/features/conductor-v2/conductor/src/ui/TimeOfInterestController.js

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ define(
4747
conductor.on('timeSystem', this.changeTimeSystem);
4848
if (conductor.timeSystem()) {
4949
this.changeTimeSystem(conductor.timeSystem());
50+
var toi = conductor.timeOfInterest();
51+
if (toi) {
52+
this.changeTimeOfInterest(toi);
53+
}
5054
}
5155

5256
$scope.$on('$destroy', this.destroy);

‎platform/features/plot/bundle.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ define([
7777
"telemetryFormatter",
7878
"telemetryHandler",
7979
"throttle",
80-
"PLOT_FIXED_DURATION"
80+
"PLOT_FIXED_DURATION",
81+
"timeConductor"
8182
]
8283
},
8384
{

‎platform/features/plot/res/templates/plot.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
this source code distribution or the Licensing information page available
2020
at runtime from the About dialog for additional information.
2121
-->
22+
<style>
23+
.gl-plot-wrapper-display-area-and-x-axis .toiPositioner {
24+
position: relative;
25+
height: 100%;
26+
}
27+
</style>
2228
<span ng-controller="PlotController as plot"
2329
class="abs holder holder-plot has-control-bar">
2430
<div class="l-control-bar" ng-show="!plot.hideExportButtons">
@@ -71,9 +77,10 @@
7177
</div>
7278

7379
<div class="gl-plot-wrapper-display-area-and-x-axis">
74-
<mct-include key="'time-of-interest'" class="show-val"
75-
parameters = "{'name': 'plot'}"
76-
></mct-include>
80+
<div class="toiPositioner"
81+
ng-if="toiPerc" ng-style="{'left': toiPerc + '%'}">
82+
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
83+
</div>
7784

7885
<div class="gl-plot-coords"
7986
ng-if="subplot.isHovering() && subplot.getHoverCoordinates()">

‎platform/features/plot/src/PlotController.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ define(
6868
telemetryFormatter,
6969
telemetryHandler,
7070
throttle,
71-
PLOT_FIXED_DURATION
71+
PLOT_FIXED_DURATION,
72+
conductor
7273
) {
7374
var self = this,
7475
plotTelemetryFormatter =
@@ -200,6 +201,7 @@ define(
200201
if (handle) {
201202
handle.unsubscribe();
202203
handle = undefined;
204+
conductor.off(changeTimeOfInterest);
203205
}
204206
}
205207

@@ -242,6 +244,17 @@ define(
242244
requery();
243245
}
244246
self.setUnsynchedStatus($scope.domainObject, follow && self.isZoomed());
247+
changeTimeOfInterest(conductor.timeOfInterest());
248+
}
249+
250+
function changeTimeOfInterest(timeOfInterest) {
251+
if (timeOfInterest !== undefined){
252+
var bounds = conductor.bounds();
253+
var range = bounds.end - bounds.start;
254+
$scope.toiPerc = ((timeOfInterest - bounds.start) / range) * 100;
255+
} else {
256+
$scope.toiPerc = undefined;
257+
}
245258
}
246259

247260
this.modeOptions = new PlotModeOptions([], subPlotFactory);
@@ -264,6 +277,10 @@ define(
264277
new PlotAxis("ranges", [], AXIS_DEFAULTS[1])
265278
];
266279

280+
changeTimeOfInterest(conductor.timeOfInterest());
281+
282+
conductor.on("timeOfInterest", changeTimeOfInterest);
283+
267284
// Watch for changes to the selected axis
268285
$scope.$watch("axes[0].active.key", domainRequery);
269286
$scope.$watch("axes[1].active.key", rangeRequery);

‎platform/features/table/res/templates/mct-table.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,17 @@
4949
</tr>
5050
</thead>
5151
<tbody>
52-
<!--ng-class="{ 'l-toi pinned': false }"-->
53-
<!--ng-click="dummyUnpin()" -->
5452
<tr ng-repeat-start="visibleRow in visibleRows track by visibleRow.rowIndex"
55-
ng-if="visibleRow.rowIndex === 10"
53+
ng-if="visibleRow.rowIndex === toiRowIndex"
5654
ng-style="{ top: visibleRow.offsetY + 'px' }"
5755
class="l-toi-tablerow pinned">
5856
<td colspan="999">
5957
<mct-include key="'time-of-interest'"></mct-include>
6058
</td>
6159
</tr>
6260
<tr ng-repeat-end
63-
ng-click="table.onRowClick($event, visibleRow.rowIndex)"
64-
ng-style="{ top: visibleRow.offsetY + 'px' }">
61+
ng-style="{ top: visibleRow.offsetY + 'px' }"
62+
ng-click="table.onRowClick($event, visibleRow.rowIndex) ">
6563
<td ng-repeat="header in displayHeaders"
6664
ng-style=" {
6765
width: columnWidths[$index] + 'px',

‎platform/features/table/src/controllers/MCTTableController.js

+29-15
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ define(
110110

111111
this.conductor.on('timeSystem', this.changeTimeSystem);
112112
this.conductor.on('timeOfInterest', this.setTimeOfInterest);
113+
this.conductor.on('bounds', this.changeBounds);
113114

114115
// If time system defined, set initially
115116
if (conductor.timeSystem()) {
@@ -124,6 +125,7 @@ define(
124125
MCTTableController.prototype.destroyConductorListeners = function () {
125126
this.conductor.off('timeSystem', this.changeTimeSystem);
126127
this.conductor.off('timeOfInterest', this.setTimeOfInterest);
128+
this.conductor.off('bounds', this.changeBounds);
127129
};
128130

129131
MCTTableController.prototype.changeTimeSystem = function () {
@@ -542,7 +544,15 @@ define(
542544
}
543545

544546
this.$scope.displayRows = this.filterAndSort(newRows || []);
545-
this.resize(newRows).then(this.setVisibleRows.bind(this));
547+
this.resize(newRows).then(function() {
548+
this.setVisibleRows();
549+
550+
var timeOfInterest = this.conductor.timeOfInterest();
551+
if (timeOfInterest) {
552+
this.setTimeOfInterest(timeOfInterest);
553+
}
554+
}.bind(this));
555+
546556
};
547557

548558
/**
@@ -604,25 +614,29 @@ define(
604614
if (this.$scope.timeColumns.indexOf(this.$scope.sortColumn) !== -1
605615
&& newTOI
606616
&& this.$scope.displayRows.length > 0) {
607-
var formattedTOI = this.toiFormatter.format(newTOI);;
608-
// searchElement, min, max
609-
this.$scope.toiRowIndex = this.binarySearch(this.$scope.displayRows,
610-
formattedTOI, 0, this.$scope.displayRows.length - 1);
611-
this.scrollToRow(this.$scope.toiRowIndex);
617+
var formattedTOI = this.toiFormatter.format(newTOI);
618+
// searchElement, min, max
619+
this.$scope.toiRowIndex = this.binarySearch(this.$scope.displayRows,
620+
formattedTOI, 0, this.$scope.displayRows.length - 1);
621+
this.scrollToRow(this.$scope.toiRowIndex);
612622
}
613623
};
614624

625+
/**
626+
* On zoom, pan, etc. reset TOI
627+
* @param bounds
628+
*/
629+
MCTTableController.prototype.changeBounds = function(bounds) {
630+
this.setTimeOfInterest(this.conductor.timeOfInterest());
631+
};
632+
615633
MCTTableController.prototype.onRowClick = function (event, rowIndex) {
616634
if (this.$scope.timeColumns.indexOf(this.$scope.sortColumn) !== -1) {
617-
if (rowIndex === this.$scope.toiRowIndex) {
618-
this.conductor.timeOfInterest(undefined);
619-
} else {
620-
var selectedTime = this.$scope.displayRows[rowIndex][this.$scope.sortColumn].text;
621-
if (selectedTime
622-
&& this.toiFormatter.validate(selectedTime)
623-
&& event.altKey) {
624-
this.conductor.timeOfInterest(this.toiFormatter.parse(selectedTime));
625-
}
635+
var selectedTime = this.$scope.displayRows[rowIndex][this.$scope.sortColumn].text;
636+
if (selectedTime
637+
&& this.toiFormatter.validate(selectedTime)
638+
&& event.altKey) {
639+
this.conductor.timeOfInterest(this.toiFormatter.parse(selectedTime));
626640
}
627641
}
628642
};

0 commit comments

Comments
 (0)
Please sign in to comment.