@@ -21,10 +21,9 @@ var ToolbarModel = widgets.DOMWidgetModel.extend({
2121
2222var ToolbarView = widgets . DOMWidgetView . extend ( {
2323 render : function ( ) {
24+ this . el . classList = 'jupyter-widgets jupyter-matplotlib-toolbar' ;
25+ this . el . classList . add ( 'widget-container' , 'widget-box' ) ;
2426 this . create_toolbar ( ) ;
25-
26- this . el . appendChild ( this . toolbar_container ) ;
27-
2827 this . model_events ( ) ;
2928 } ,
3029
@@ -33,11 +32,9 @@ var ToolbarView = widgets.DOMWidgetView.extend({
3332
3433 this . current_action = '' ;
3534
36- this . toolbar_container = document . createElement ( 'div' ) ;
37- this . toolbar_container . classList = this . get_container_class ( ) ;
3835 this . toggle_button = document . createElement ( 'button' ) ;
3936
40- this . toggle_button . classList = 'ipympl_button jupyter-widgets jupyter-button' ;
37+ this . toggle_button . classList = 'jupyter-matplotlib-button jupyter-widgets jupyter-button' ;
4138 this . toggle_button . setAttribute ( 'href' , '#' ) ;
4239 this . toggle_button . setAttribute ( 'title' , 'Toggle Interaction' ) ;
4340 this . toggle_button . style . outline = 'none' ;
@@ -47,12 +44,10 @@ var ToolbarView = widgets.DOMWidgetView.extend({
4744 icon . classList = 'center fa fa-bars' ;
4845 this . toggle_button . appendChild ( icon ) ;
4946
50- this . toolbar_container . appendChild ( this . toggle_button ) ;
51-
47+ this . el . appendChild ( this . toggle_button ) ;
5248 this . toolbar = document . createElement ( 'div' ) ;
53- this . toolbar . classList = this . get_container_class ( ) ;
54- this . toolbar_container . appendChild ( this . toolbar ) ;
55-
49+ this . toolbar . classList = 'widget-container widget-box' ;
50+ this . el . appendChild ( this . toolbar ) ;
5651 this . buttons = [ this . toggle_button ] ;
5752
5853 for ( var toolbar_ind in toolbar_items ) {
@@ -63,7 +58,7 @@ var ToolbarView = widgets.DOMWidgetView.extend({
6358 if ( ! name ) { continue ; } ;
6459
6560 var button = document . createElement ( 'button' ) ;
66- button . classList = 'ipympl_button jupyter-widgets jupyter-button' ;
61+ button . classList = 'jupyter-matplotlib-button jupyter-widgets jupyter-button' ;
6762 button . setAttribute ( 'href' , '#' ) ;
6863 button . setAttribute ( 'title' , tooltip ) ;
6964 button . style . outline = 'none' ;
@@ -78,15 +73,19 @@ var ToolbarView = widgets.DOMWidgetView.extend({
7873 this . toolbar . appendChild ( button ) ;
7974 }
8075
76+ this . set_orientation ( this . el ) ;
77+ this . set_orientation ( this . toolbar ) ;
8178 this . set_buttons_style ( ) ;
8279 } ,
8380
84- get_container_class : function ( ) {
81+ set_orientation : function ( el ) {
8582 var orientation = this . model . get ( 'orientation' ) ;
8683 if ( orientation == 'vertical' ) {
87- return 'jupyter-widgets widget-container widget-box widget-vbox' ;
84+ el . classList . remove ( 'widget-hbox' ) ;
85+ el . classList . add ( 'widget-vbox' ) ;
8886 } else {
89- return 'jupyter-widgets widget-container widget-box widget-hbox' ;
87+ el . classList . add ( 'widget-hbox' ) ;
88+ el . classList . remove ( 'widget-vbox' ) ;
9089 }
9190 } ,
9291
@@ -159,8 +158,8 @@ var ToolbarView = widgets.DOMWidgetView.extend({
159158 } ,
160159
161160 update_orientation : function ( ) {
162- this . toolbar_container . classList = this . get_container_class ( ) ;
163- this . toolbar . classList = this . get_container_class ( ) ;
161+ this . set_orientation ( this . el ) ;
162+ this . set_orientation ( this . toolbar ) ;
164163 }
165164} ) ;
166165
0 commit comments