@@ -191,16 +191,7 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
191191 const viewRangeStart = viewRange . getStart ( ) - ( offset ? offset : BigInt ( 0 ) ) ;
192192 const viewRangeEnd = viewRange . getEnd ( ) - ( offset ? offset : BigInt ( 0 ) ) ;
193193 this . unitController = new TimeGraphUnitController ( absoluteRange , { start : viewRangeStart , end : viewRangeEnd } ) ;
194- this . unitController . numberTranslator = this . unitController . numberTranslator = ( theNumber : bigint ) => {
195- const originalStart = this . state . currentRange . getStart ( ) ;
196- theNumber += originalStart ;
197- const zeroPad = ( num : bigint ) => String ( num ) . padStart ( 3 , '0' ) ;
198- const seconds = theNumber / BigInt ( 1000000000 ) ;
199- const millis = zeroPad ( ( theNumber / BigInt ( 1000000 ) ) % BigInt ( 1000 ) ) ;
200- const micros = zeroPad ( ( theNumber / BigInt ( 1000 ) ) % BigInt ( 1000 ) ) ;
201- const nanos = zeroPad ( theNumber % BigInt ( 1000 ) ) ;
202- return seconds + '.' + millis + ' ' + micros + ' ' + nanos ;
203- } ;
194+ this . unitController . numberTranslator = createNumberTranslator ( true , this . state . currentRange . getStart ( ) ) ;
204195 this . unitController . worldRenderFactor = 0.25 ;
205196 this . historyHandler = new UnitControllerHistoryHandler ( this . unitController ) ;
206197 if ( this . props . persistedState ?. currentTimeSelection ) {
@@ -793,14 +784,19 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
793784 ganttChartRange . getDuration ( ) ,
794785 { start : ganttChartRange . getStart ( ) , end : ganttChartRange . getEnd ( ) }
795786 ) ;
796- ganttChartUnitController . numberTranslator = ( theNumber : bigint ) => {
797- const zeroPad = ( num : bigint ) => String ( num ) . padStart ( 3 , '0' ) ;
798- const seconds = theNumber / BigInt ( 1000000000 ) ;
799- const millis = zeroPad ( ( theNumber / BigInt ( 1000000 ) ) % BigInt ( 1000 ) ) ;
800- const micros = zeroPad ( ( theNumber / BigInt ( 1000 ) ) % BigInt ( 1000 ) ) ;
801- const nanos = zeroPad ( theNumber % BigInt ( 1000 ) ) ;
802- return seconds + '.' + millis + ' ' + micros + ' ' + nanos ;
803- } ;
787+ ganttChartUnitController . numberTranslator = createNumberTranslator ( false ) ;
788+ // Restore view range if available, otherwise set to global view range
789+ const fgViewRange = this . state . ganttChartRanges ?. [ output . id ] ;
790+ if ( fgViewRange ) {
791+ ganttChartUnitController . viewRange = fgViewRange ;
792+ } else {
793+ // Use the global view range from the parent unit controller
794+ const globalViewRange = this . unitController . viewRange ;
795+ ganttChartUnitController . viewRange = {
796+ start : globalViewRange . start ,
797+ end : globalViewRange . end
798+ } ;
799+ }
804800 // Listen for view range changes
805801 ganttChartUnitController . onViewRangeChanged ( ( _old , newRange ) => {
806802 this . handleGanttChartViewRangeChange ( output . id , newRange ) ;
0 commit comments