@@ -110,6 +110,7 @@ define(
110
110
111
111
this . conductor . on ( 'timeSystem' , this . changeTimeSystem ) ;
112
112
this . conductor . on ( 'timeOfInterest' , this . setTimeOfInterest ) ;
113
+ this . conductor . on ( 'bounds' , this . changeBounds ) ;
113
114
114
115
// If time system defined, set initially
115
116
if ( conductor . timeSystem ( ) ) {
@@ -124,6 +125,7 @@ define(
124
125
MCTTableController . prototype . destroyConductorListeners = function ( ) {
125
126
this . conductor . off ( 'timeSystem' , this . changeTimeSystem ) ;
126
127
this . conductor . off ( 'timeOfInterest' , this . setTimeOfInterest ) ;
128
+ this . conductor . off ( 'bounds' , this . changeBounds ) ;
127
129
} ;
128
130
129
131
MCTTableController . prototype . changeTimeSystem = function ( ) {
@@ -542,7 +544,15 @@ define(
542
544
}
543
545
544
546
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
+
546
556
} ;
547
557
548
558
/**
@@ -604,25 +614,29 @@ define(
604
614
if ( this . $scope . timeColumns . indexOf ( this . $scope . sortColumn ) !== - 1
605
615
&& newTOI
606
616
&& 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 ) ;
612
622
}
613
623
} ;
614
624
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
+
615
633
MCTTableController . prototype . onRowClick = function ( event , rowIndex ) {
616
634
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 ) ) ;
626
640
}
627
641
}
628
642
} ;
0 commit comments