@@ -16,20 +16,16 @@ var modebarConfig = require('./modebar_config');
16
16
/**
17
17
* UI controller for interactive plots
18
18
* @Class
19
- * @Param {object} config
20
- * @Param {object} config.buttons nested arrays of grouped buttons to initialize
21
- * @Param {object} config.container container div to append modebar
22
- * @Param {object} config.Plotly main plotly namespace module
23
- * @Param {object} config.graphInfo primary plot object containing data and layout
19
+ * @Param {object} opts
20
+ * @Param {object} opts.buttons nested arrays of grouped buttons to initialize
21
+ * @Param {object} opts.container container div to append modebar
22
+ * @Param {object} opts.graphInfo primary plot object containing data and layout
24
23
*/
25
- function ModeBar ( config ) {
26
-
27
- if ( ! ( this instanceof ModeBar ) ) return new ModeBar ( ) ;
28
-
24
+ function ModeBar ( opts ) {
29
25
var _this = this ;
30
26
31
27
this . _snapshotInProgress = false ;
32
- this . graphInfo = config . graphInfo ;
28
+ this . graphInfo = opts . graphInfo ;
33
29
this . element = document . createElement ( 'div' ) ;
34
30
35
31
if ( this . graphInfo . _context . displayModeBar === 'hover' ) {
@@ -38,7 +34,7 @@ function ModeBar (config) {
38
34
this . element . className = 'modebar' ;
39
35
}
40
36
41
- this . buttons = config . buttons ;
37
+ this . buttons = opts . buttons ;
42
38
this . buttonElements = [ ] ;
43
39
44
40
this . buttons . forEach ( function ( buttonGroup ) {
@@ -64,7 +60,7 @@ function ModeBar (config) {
64
60
this . element . appendChild ( this . getLogo ( ) ) ;
65
61
}
66
62
67
- config . container . appendChild ( this . element ) ;
63
+ opts . container . appendChild ( this . element ) ;
68
64
69
65
this . updateActiveButton ( ) ;
70
66
}
@@ -493,9 +489,7 @@ proto.toImage = function() {
493
489
494
490
proto . sendDataToCloud = function ( ) {
495
491
var gd = this . graphInfo ;
496
- Plotly . Plots . sendDataToCloud ( gd )
497
- } ;
498
-
492
+ Plotly . Plots . sendDataToCloud ( gd ) ;
499
493
} ;
500
494
501
495
module . exports = ModeBar ;
0 commit comments