@@ -44,14 +44,14 @@ function render_pipeline_graph() {
4444 const units = UNIT_DATA . filter ( unit => unit . duration >= min_time ) ;
4545
4646 const graph_height = Y_TICK_DIST * units . length ;
47- const { ctx, graph_width, width , height , px_per_sec} = draw_graph_axes ( 'pipeline-graph' , graph_height ) ;
47+ const { ctx, graph_width, canvas_width , canvas_height , px_per_sec} = draw_graph_axes ( 'pipeline-graph' , graph_height ) ;
4848 const container = document . getElementById ( 'pipeline-container' ) ;
49- container . style . width = width ;
50- container . style . height = height ;
49+ container . style . width = canvas_width ;
50+ container . style . height = canvas_height ;
5151
5252 // Canvas for hover highlights. This is a separate layer to improve performance.
53- const linectx = setup_canvas ( 'pipeline-graph-lines' , width , height ) ;
54- linectx . clearRect ( 0 , 0 , width , height ) ;
53+ const linectx = setup_canvas ( 'pipeline-graph-lines' , canvas_width , canvas_height ) ;
54+ linectx . clearRect ( 0 , 0 , canvas_width , canvas_height ) ;
5555
5656 // Draw Y tick marks.
5757 for ( let n = 1 ; n < units . length ; n ++ ) {
@@ -112,7 +112,7 @@ function render_pipeline_graph() {
112112 ctx . font = '14px sans-serif' ;
113113 const label = `${ unit . name } ${ unit . target } ${ unit . duration } s` ;
114114 const text_info = ctx . measureText ( label ) ;
115- const label_x = Math . min ( x + 5.0 , graph_width - text_info . width ) ;
115+ const label_x = Math . min ( x + 5.0 , canvas_width - text_info . width - X_LINE ) ;
116116 ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 - 6 ) ;
117117 draw_dep_lines ( ctx , unit . i , false ) ;
118118 }
@@ -156,7 +156,7 @@ function render_timing_graph() {
156156 const TOP_MARGIN = 10 ;
157157 const GRAPH_HEIGHT = AXIS_HEIGHT - TOP_MARGIN ;
158158
159- const { width , graph_width, ctx} = draw_graph_axes ( 'timing-graph' , AXIS_HEIGHT ) ;
159+ const { canvas_width , graph_width, ctx} = draw_graph_axes ( 'timing-graph' , AXIS_HEIGHT ) ;
160160
161161 // Draw Y tick marks and labels.
162162 let max_v = 0 ;
@@ -235,7 +235,7 @@ function render_timing_graph() {
235235 // Draw a legend.
236236 ctx . restore ( ) ;
237237 ctx . save ( ) ;
238- ctx . translate ( width - 200 , MARGIN ) ;
238+ ctx . translate ( canvas_width - 200 , MARGIN ) ;
239239 // background
240240 ctx . fillStyle = '#fff' ;
241241 ctx . strokeStyle = '#000' ;
@@ -300,11 +300,11 @@ function draw_graph_axes(id, graph_height) {
300300 // browsers, but should be ok for many desktop environments.
301301 const graph_width = Math . min ( scale * DURATION , 4096 ) ;
302302 const px_per_sec = Math . floor ( graph_width / DURATION ) ;
303- const width = Math . max ( graph_width + X_LINE + 30 , X_LINE + 250 ) ;
304- const height = graph_height + MARGIN + Y_LINE ;
305- let ctx = setup_canvas ( id , width , height ) ;
303+ const canvas_width = Math . max ( graph_width + X_LINE + 30 , X_LINE + 250 ) ;
304+ const canvas_height = graph_height + MARGIN + Y_LINE ;
305+ let ctx = setup_canvas ( id , canvas_width , canvas_height ) ;
306306 ctx . fillStyle = '#f7f7f7' ;
307- ctx . fillRect ( 0 , 0 , width , height ) ;
307+ ctx . fillRect ( 0 , 0 , canvas_width , canvas_height ) ;
308308
309309 ctx . lineWidth = 2 ;
310310 ctx . font = '16px sans-serif' ;
@@ -325,11 +325,11 @@ function draw_graph_axes(id, graph_height) {
325325 for ( let n = 0 ; n < num_ticks ; n ++ ) {
326326 const x = X_LINE + ( ( n + 1 ) * tick_dist ) ;
327327 ctx . beginPath ( ) ;
328- ctx . moveTo ( x , height - Y_LINE ) ;
329- ctx . lineTo ( x , height - Y_LINE + 5 ) ;
328+ ctx . moveTo ( x , canvas_height - Y_LINE ) ;
329+ ctx . lineTo ( x , canvas_height - Y_LINE + 5 ) ;
330330 ctx . stroke ( ) ;
331331
332- ctx . fillText ( `${ ( n + 1 ) * step } s` , x , height - Y_LINE + 20 ) ;
332+ ctx . fillText ( `${ ( n + 1 ) * step } s` , x , canvas_height - Y_LINE + 20 ) ;
333333 }
334334
335335 // Draw vertical lines.
@@ -344,7 +344,7 @@ function draw_graph_axes(id, graph_height) {
344344 }
345345 ctx . strokeStyle = '#000' ;
346346 ctx . setLineDash ( [ ] ) ;
347- return { width , height , graph_width, graph_height, ctx, px_per_sec} ;
347+ return { canvas_width , canvas_height , graph_width, graph_height, ctx, px_per_sec} ;
348348}
349349
350350function round_up ( n , step ) {
0 commit comments