2121import { Circuit } from "./circuit/circuit.js" ;
2222import { draw } from "./draw/main_draw.js" ;
2323import { EditorState } from "./editor/editor_state.js" ;
24- import { setIndentCircuitLines , setCurveConnectors } from "./draw/config.js" ;
24+ import {
25+ setIndentCircuitLines ,
26+ setCurveConnectors ,
27+ setShowAnnotationRegions ,
28+ } from "./draw/config.js" ;
2529
2630const CANVAS_W = 600 ;
2731const CANVAS_H = 300 ;
@@ -48,6 +52,7 @@ function render({ model, el }) {
4852 getStim : ( ) => model . get ( "stim" ) ,
4953 getIndentCircuitLines : ( ) => model . get ( "indentCircuitLines" ) ,
5054 getCurveConnectors : ( ) => model . get ( "curveConnectors" ) ,
55+ getShowAnnotationRegions : ( ) => model . get ( "showAnnotationRegions" ) ,
5156 } ;
5257
5358 const canvas = initCanvas ( el ) ;
@@ -76,6 +81,10 @@ function render({ model, el }) {
7681 setCurveConnectors ( traitlets . getCurveConnectors ( ) ) ;
7782 editorState . force_redraw ( ) ;
7883 } ) ;
84+ model . on ( "change:showAnnotationRegions" , ( ) => {
85+ setShowAnnotationRegions ( traitlets . getShowAnnotationRegions ( ) ) ;
86+ editorState . force_redraw ( ) ;
87+ } ) ;
7988
8089 // Listeners on editor state that trigger redraws
8190 editorState . rev . changes ( ) . subscribe ( ( ) => {
@@ -90,6 +99,7 @@ function render({ model, el }) {
9099 // Configure initial settings and stim
91100 setIndentCircuitLines ( traitlets . getIndentCircuitLines ( ) ) ;
92101 setCurveConnectors ( traitlets . getCurveConnectors ( ) ) ;
102+ setShowAnnotationRegions ( traitlets . getShowAnnotationRegions ( ) ) ;
93103 commitStimCircuit ( traitlets . getStim ( ) ) ;
94104}
95105export default { render } ;
0 commit comments