@@ -312,23 +312,22 @@ export class TimelineFlameChartView extends
312312 this . detailsSplitWidget . setSidebarWidget ( this . detailsView ) ;
313313 this . detailsSplitWidget . show ( this . element ) ;
314314
315+ // Event listeners for annotations.
315316 this . onMainAddEntryLabelAnnotation = this . onAddEntryLabelAnnotation . bind ( this , this . mainDataProvider ) ;
316317 this . onNetworkAddEntryLabelAnnotation = this . onAddEntryLabelAnnotation . bind ( this , this . networkDataProvider ) ;
317318 this . #onMainEntriesLinkAnnotationCreated = event =>
318319 this . onEntriesLinkAnnotationCreate ( this . mainDataProvider , event . data . entryFromIndex ) ;
319320 this . #onNetworkEntriesLinkAnnotationCreated = event =>
320321 this . onEntriesLinkAnnotationCreate ( this . networkDataProvider , event . data . entryFromIndex ) ;
321- if ( Root . Runtime . experiments . isEnabled ( Root . Runtime . ExperimentName . TIMELINE_ANNOTATIONS ) ) {
322- this . mainFlameChart . addEventListener (
323- PerfUI . FlameChart . Events . ENTRY_LABEL_ANNOTATION_ADDED , this . onMainAddEntryLabelAnnotation , this ) ;
324- this . networkFlameChart . addEventListener (
325- PerfUI . FlameChart . Events . ENTRY_LABEL_ANNOTATION_ADDED , this . onNetworkAddEntryLabelAnnotation , this ) ;
322+ this . mainFlameChart . addEventListener (
323+ PerfUI . FlameChart . Events . ENTRY_LABEL_ANNOTATION_ADDED , this . onMainAddEntryLabelAnnotation , this ) ;
324+ this . networkFlameChart . addEventListener (
325+ PerfUI . FlameChart . Events . ENTRY_LABEL_ANNOTATION_ADDED , this . onNetworkAddEntryLabelAnnotation , this ) ;
326326
327- this . mainFlameChart . addEventListener (
328- PerfUI . FlameChart . Events . ENTRIES_LINK_ANNOTATION_CREATED , this . #onMainEntriesLinkAnnotationCreated, this ) ;
329- this . networkFlameChart . addEventListener (
330- PerfUI . FlameChart . Events . ENTRIES_LINK_ANNOTATION_CREATED , this . #onNetworkEntriesLinkAnnotationCreated, this ) ;
331- }
327+ this . mainFlameChart . addEventListener (
328+ PerfUI . FlameChart . Events . ENTRIES_LINK_ANNOTATION_CREATED , this . #onMainEntriesLinkAnnotationCreated, this ) ;
329+ this . networkFlameChart . addEventListener (
330+ PerfUI . FlameChart . Events . ENTRIES_LINK_ANNOTATION_CREATED , this . #onNetworkEntriesLinkAnnotationCreated, this ) ;
332331
333332 this . detailsView . addEventListener ( TimelineTreeView . Events . TREE_ROW_HOVERED , node => {
334333 if ( ! Root . Runtime . experiments . isEnabled ( Root . Runtime . ExperimentName . TIMELINE_DIM_UNRELATED_EVENTS ) ) {
@@ -910,30 +909,30 @@ export class TimelineFlameChartView extends
910909 this . delegate . select ( selectionFromRangeMilliSeconds (
911910 Trace . Types . Timing . MilliSeconds ( startTime ) , Trace . Types . Timing . MilliSeconds ( endTime ) ) ) ;
912911
913- if ( Root . Runtime . experiments . isEnabled ( Root . Runtime . ExperimentName . TIMELINE_ANNOTATIONS ) ) {
914- const bounds = Trace . Helpers . Timing . traceWindowFromMilliSeconds (
915- Trace . Types . Timing . MilliSeconds ( startTime ) ,
916- Trace . Types . Timing . MilliSeconds ( endTime ) ,
917- ) ;
912+ // We need to check if the user is updating the range because they are
913+ // creating a time range annotation.
914+ const bounds = Trace . Helpers . Timing . traceWindowFromMilliSeconds (
915+ Trace . Types . Timing . MilliSeconds ( startTime ) ,
916+ Trace . Types . Timing . MilliSeconds ( endTime ) ,
917+ ) ;
918918
919- // If the current time range annotation exists, the range selection
920- // for it is in progress and we need to update its bounds.
921- //
922- // When the range selection is finished, the current range is set to null.
923- // If the current selection is null, create a new time range annotations.
924- if ( this . #timeRangeSelectionAnnotation) {
925- this . #timeRangeSelectionAnnotation. bounds = bounds ;
926- ModificationsManager . activeManager ( ) ?. updateAnnotation ( this . #timeRangeSelectionAnnotation) ;
927- } else {
928- this . #timeRangeSelectionAnnotation = {
929- type : 'TIME_RANGE' ,
930- label : '' ,
931- bounds,
932- } ;
933- // Before creating a new range, make sure to delete the empty ranges.
934- ModificationsManager . activeManager ( ) ?. deleteEmptyRangeAnnotations ( ) ;
935- ModificationsManager . activeManager ( ) ?. createAnnotation ( this . #timeRangeSelectionAnnotation) ;
936- }
919+ // If the current time range annotation exists, the range selection
920+ // for it is in progress and we need to update its bounds.
921+ //
922+ // When the range selection is finished, the current range is set to null.
923+ // If the current selection is null, create a new time range annotations.
924+ if ( this . #timeRangeSelectionAnnotation) {
925+ this . #timeRangeSelectionAnnotation. bounds = bounds ;
926+ ModificationsManager . activeManager ( ) ?. updateAnnotation ( this . #timeRangeSelectionAnnotation) ;
927+ } else {
928+ this . #timeRangeSelectionAnnotation = {
929+ type : 'TIME_RANGE' ,
930+ label : '' ,
931+ bounds,
932+ } ;
933+ // Before creating a new range, make sure to delete the empty ranges.
934+ ModificationsManager . activeManager ( ) ?. deleteEmptyRangeAnnotations ( ) ;
935+ ModificationsManager . activeManager ( ) ?. createAnnotation ( this . #timeRangeSelectionAnnotation) ;
937936 }
938937 }
939938
0 commit comments