@@ -26,11 +26,12 @@ import {
26
26
import {
27
27
COLORS ,
28
28
EVENT_ROW_PADDING ,
29
- EVENT_DIAMETER ,
29
+ USER_TIMING_MARK_SIZE ,
30
30
BORDER_SIZE ,
31
31
} from './constants' ;
32
32
33
- const ROW_HEIGHT_FIXED = EVENT_ROW_PADDING + EVENT_DIAMETER + EVENT_ROW_PADDING ;
33
+ const ROW_HEIGHT_FIXED =
34
+ EVENT_ROW_PADDING + USER_TIMING_MARK_SIZE + EVENT_ROW_PADDING ;
34
35
35
36
export class UserTimingMarksView extends View {
36
37
_marks : UserTimingMark [ ] ;
@@ -81,13 +82,15 @@ export class UserTimingMarksView extends View {
81
82
const { timestamp} = mark ;
82
83
83
84
const x = timestampToPosition ( timestamp , scaleFactor , frame ) ;
84
- const radius = EVENT_DIAMETER / 2 ;
85
+ const size = USER_TIMING_MARK_SIZE ;
86
+ const halfSize = size / 2 ;
87
+
85
88
const markRect : Rect = {
86
89
origin : {
87
- x : x - radius ,
90
+ x : x - halfSize ,
88
91
y : baseY ,
89
92
} ,
90
- size : { width : EVENT_DIAMETER , height : EVENT_DIAMETER } ,
93
+ size : { width : size , height : size } ,
91
94
} ;
92
95
if ( ! rectIntersectsRect ( markRect , rect ) ) {
93
96
return ; // Not in view
@@ -98,11 +101,14 @@ export class UserTimingMarksView extends View {
98
101
: COLORS . USER_TIMING ;
99
102
100
103
if ( fillStyle !== null ) {
101
- const y = markRect . origin . y + radius ;
104
+ const y = baseY + halfSize ;
102
105
103
106
context . beginPath ( ) ;
104
107
context . fillStyle = fillStyle ;
105
- context . arc ( x , y , radius , 0 , 2 * Math . PI ) ;
108
+ context . moveTo ( x , y - halfSize ) ;
109
+ context . lineTo ( x + halfSize , y ) ;
110
+ context . lineTo ( x , y + halfSize ) ;
111
+ context . lineTo ( x - halfSize , y ) ;
106
112
context . fill ( ) ;
107
113
}
108
114
}
@@ -198,7 +204,7 @@ export class UserTimingMarksView extends View {
198
204
) ;
199
205
const hoverTimestamp = positionToTimestamp ( location . x , scaleFactor , frame ) ;
200
206
const markTimestampAllowance = widthToDuration (
201
- EVENT_DIAMETER / 2 ,
207
+ USER_TIMING_MARK_SIZE / 2 ,
202
208
scaleFactor ,
203
209
) ;
204
210
0 commit comments