@@ -198,8 +198,8 @@ function render({ model, el }) {
198198
199199 const sizeLabel = document . createElement ( 'div' ) ;
200200 sizeLabel . style . cssText =
201- 'position:absolute;bottom:22px;right:22px;padding:3px 7px;background:rgba(0,0,0,0.7 );' +
202- 'color:white;font-size:11px; border-radius:4px ;display:none;pointer-events:none;z-index:21;' ;
201+ 'position:absolute;bottom:22px;right:22px;padding:7px 14px ;background:rgba(0,0,0,0.65 );' +
202+ 'color:white;font-size:12px;font-family:monospace; border-radius:5px ;display:none;pointer-events:none;z-index:21;' ;
203203 outerDiv . appendChild ( sizeLabel ) ;
204204
205205 // ── Help badge (figure-level) ─────────────────────────────────────────────
@@ -407,8 +407,8 @@ function render({ model, el }) {
407407 scaleBar . style . cssText = 'position:absolute;pointer-events:none;display:none;z-index:7;' ;
408408 statusBar = document . createElement ( 'div' ) ;
409409 statusBar . style . cssText =
410- 'position:absolute;padding:2px 6px ;background:rgba(0,0,0,0.55 );color:white;' +
411- 'font-size:10px ;font-family:monospace;border-radius:4px ;pointer-events:none;' +
410+ 'position:absolute;padding:7px 14px ;background:rgba(0,0,0,0.65 );color:white;' +
411+ 'font-size:12px ;font-family:monospace;border-radius:5px ;pointer-events:none;' +
412412 'white-space:nowrap;display:none;z-index:9;' ;
413413 yAxisCanvas = document . createElement ( 'canvas' ) ;
414414 yAxisCanvas . style . cssText =
@@ -474,9 +474,9 @@ function render({ model, el }) {
474474 wrap . appendChild ( markersCanvas ) ;
475475 statusBar = document . createElement ( 'div' ) ;
476476 statusBar . style . cssText =
477- 'position:absolute;bottom:4px;right:4px;padding:2px 6px ;' +
478- 'background:rgba(0,0,0,0.55 );color:white;font-size:10px ;font-family:monospace;' +
479- 'border-radius:4px ;pointer-events:none;white-space:nowrap;display:none;z-index:9;' ;
477+ 'position:absolute;bottom:4px;right:4px;padding:7px 14px ;' +
478+ 'background:rgba(0,0,0,0.65 );color:white;font-size:12px ;font-family:monospace;' +
479+ 'border-radius:5px ;pointer-events:none;white-space:nowrap;display:none;z-index:9;' ;
480480 wrap . appendChild ( statusBar ) ;
481481 wrapNode = wrap ;
482482 }
@@ -548,7 +548,16 @@ function render({ model, el }) {
548548 model . on ( `change:panel_${ id } _json` , ( ) => {
549549 const p2 = panels . get ( id ) ;
550550 if ( ! p2 ) return ;
551- try { p2 . state = JSON . parse ( model . get ( `panel_${ id } _json` ) ) ; }
551+ try {
552+ const newState = JSON . parse ( model . get ( `panel_${ id } _json` ) ) ;
553+ // Preserve the current view (zoom/pan) so Python pushes don't reset it
554+ if ( p2 . state && p2 . kind === '2d' ) {
555+ newState . zoom = p2 . state . zoom ;
556+ newState . center_x = p2 . state . center_x ;
557+ newState . center_y = p2 . state . center_y ;
558+ }
559+ p2 . state = newState ;
560+ }
552561 catch ( _ ) { return ; }
553562 p2 . _hoverSi = - 1 ; p2 . _hoverI = - 1 ;
554563 _redrawPanel ( p2 ) ;
@@ -659,7 +668,16 @@ function render({ model, el }) {
659668 model . on ( `change:panel_${ id } _json` , ( ) => {
660669 const p2 = panels . get ( id ) ;
661670 if ( ! p2 ) return ;
662- try { p2 . state = JSON . parse ( model . get ( `panel_${ id } _json` ) ) ; }
671+ try {
672+ const newState = JSON . parse ( model . get ( `panel_${ id } _json` ) ) ;
673+ // Preserve the current view (zoom/pan) so Python pushes don't reset it
674+ if ( p2 . state && p2 . kind === '2d' ) {
675+ newState . zoom = p2 . state . zoom ;
676+ newState . center_x = p2 . state . center_x ;
677+ newState . center_y = p2 . state . center_y ;
678+ }
679+ p2 . state = newState ;
680+ }
663681 catch ( _ ) { return ; }
664682 p2 . _hoverSi = - 1 ; p2 . _hoverI = - 1 ;
665683 _redrawPanel ( p2 ) ;
0 commit comments