1- import { Graph } from "./Graph.js" ;
2- import type { BlockPtr , Func , Pass , SampleCounts } from "./iongraph.js" ;
31import { dequal } from "./dequal.js" ;
42import { E } from "./dom.js" ;
3+ import { Graph } from "./Graph.js" ;
4+ import type { BlockPtr , Func , Pass , SampleCounts } from "./iongraph.js" ;
5+
6+ type KeyPasses = [ number | null , number | null , number | null , number | null ] ;
57
68export interface GraphViewerProps {
79 func : Func ,
@@ -10,8 +12,6 @@ export interface GraphViewerProps {
1012 sampleCounts ?: SampleCounts ,
1113}
1214
13- type KeyPasses = [ number | null , number | null , number | null , number | null ] ;
14-
1515export class GraphViewer {
1616 func : Func ;
1717 passNumber : number ;
@@ -26,13 +26,13 @@ export class GraphViewer {
2626
2727 constructor ( root : HTMLElement , {
2828 func,
29- pass : propsPass = 0 ,
29+ pass = 0 ,
3030
3131 sampleCounts
3232 } : GraphViewerProps ) {
3333 this . graph = null ;
3434 this . func = func ;
35- this . passNumber = propsPass ;
35+ this . passNumber = pass ;
3636 this . sampleCounts = sampleCounts ;
3737
3838 this . keyPasses = [ null , null , null , null ] ;
@@ -79,7 +79,7 @@ export class GraphViewer {
7979 div . style . position = "relative" ;
8080 } )
8181 this . sidebarLinks = func . passes . map ( ( pass , i ) => (
82- E ( "a" , [ "ig-link-normal" , "ig-pv1" , "ig-ph2" , "ig-flex" , "ig-g2" , ] , a => {
82+ E ( "a" , [ "ig-link-normal" , "ig-pv1" , "ig-ph2" , "ig-flex" , "ig-g2" ] , a => {
8383 a . href = "#" ;
8484 a . addEventListener ( "click" , e => {
8585 e . preventDefault ( ) ;
@@ -100,12 +100,12 @@ export class GraphViewer {
100100 ] ) ;
101101 root . appendChild ( this . container ) ;
102102
103- this . update ( ) ;
104-
105103 this . keydownHandler = this . keydownHandler . bind ( this ) ;
106104 this . tweakHandler = this . tweakHandler . bind ( this ) ;
107105 window . addEventListener ( "keydown" , this . keydownHandler ) ;
108106 window . addEventListener ( "tweak" , this . tweakHandler ) ;
107+
108+ this . update ( ) ;
109109 }
110110
111111 destroy ( ) {
0 commit comments