@@ -77,6 +77,7 @@ const ViewerModel = widgets.DOMWidgetModel.extend({
7777 select_roi : false ,
7878 _reset_crop_requested : false ,
7979 _scale_factors : new Uint8Array ( [ 1 , 1 , 1 ] ) ,
80+ units : '' ,
8081 point_sets : null ,
8182 point_set_colors : new Float32Array ( [ 0. , 0. , 0. ] ) ,
8283 point_set_opacities : new Float32Array ( [ 1.0 ] ) ,
@@ -667,6 +668,8 @@ const ViewerView = widgets.DOMWidgetView.extend({
667668 this . geometry_opacities_changed ( )
668669 }
669670 this . mode_changed ( )
671+
672+ this . units_changed ( )
670673 } ,
671674
672675 render : function ( ) {
@@ -691,6 +694,7 @@ const ViewerView = widgets.DOMWidgetView.extend({
691694 this . model . on ( 'change:rotate' , this . rotate_changed , this )
692695 this . model . on ( 'change:annotations' , this . annotations_changed , this )
693696 this . model . on ( 'change:mode' , this . mode_changed , this )
697+ this . model . on ( 'change:units' , this . units_changed , this )
694698 this . model . on ( 'change:camera' , this . camera_changed , this )
695699
696700 let toDecompress = [ ]
@@ -924,6 +928,15 @@ const ViewerView = widgets.DOMWidgetView.extend({
924928 }
925929 } ,
926930
931+ units_changed : function ( ) {
932+ const units = this . model . get ( 'units' )
933+ if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) ) {
934+ console . log ( `Units: ${ units } ` )
935+ const viewProxy = this . model . itkVtkViewer . getViewProxy ( )
936+ viewProxy . setUnits ( units )
937+ }
938+ } ,
939+
927940 camera_changed : function ( ) {
928941 const camera = this . model . get ( 'camera' )
929942 if ( this . model . hasOwnProperty ( 'itkVtkViewer' ) ) {
0 commit comments