12
12
var Plotly = require ( '../../plotly' ) ;
13
13
var d3 = require ( 'd3' ) ;
14
14
15
+ var Icons = require ( '../../../build/ploticon' ) ;
15
16
var modebarConfig = require ( './modebar_config' ) ;
17
+
18
+
16
19
/**
17
20
* UI controller for interactive plots
18
21
* @Class
@@ -108,7 +111,7 @@ proto.createButton = function (config) {
108
111
button . setAttribute ( 'data-toggle' , config . toggle ) ;
109
112
if ( config . toggle ) button . classList . add ( 'active' ) ;
110
113
111
- button . appendChild ( this . createIcon ( Plotly . Icons [ config . icon ] ) ) ;
114
+ button . appendChild ( this . createIcon ( Icons [ config . icon ] ) ) ;
112
115
113
116
return button ;
114
117
} ;
@@ -121,8 +124,7 @@ proto.createButton = function (config) {
121
124
* @Return {HTMLelement}
122
125
*/
123
126
proto . createIcon = function ( thisIcon ) {
124
- var iconDef = Plotly . Icons ,
125
- iconHeight = iconDef . ascent - iconDef . descent ,
127
+ var iconHeight = Icons . ascent - Icons . descent ,
126
128
svgNS = 'http://www.w3.org/2000/svg' ,
127
129
icon = document . createElementNS ( svgNS , 'svg' ) ,
128
130
path = document . createElementNS ( svgNS , 'path' ) ;
@@ -132,7 +134,7 @@ proto.createIcon = function (thisIcon) {
132
134
icon . setAttribute ( 'viewBox' , [ 0 , 0 , thisIcon . width , iconHeight ] . join ( ' ' ) ) ;
133
135
134
136
path . setAttribute ( 'd' , thisIcon . path ) ;
135
- path . setAttribute ( 'transform' , 'matrix(1 0 0 -1 0 ' + iconDef . ascent + ')' ) ;
137
+ path . setAttribute ( 'transform' , 'matrix(1 0 0 -1 0 ' + Icons . ascent + ')' ) ;
136
138
icon . appendChild ( path ) ;
137
139
138
140
return icon ;
@@ -202,7 +204,7 @@ proto.getLogo = function(){
202
204
a . setAttribute ( 'data-title' , 'Produced with Plotly' ) ;
203
205
a . className = 'modebar-btn plotlyjsicon modebar-btn--logo' ;
204
206
205
- a . appendChild ( this . createIcon ( Plotly . Icons . plotlylogo ) ) ;
207
+ a . appendChild ( this . createIcon ( Icons . plotlylogo ) ) ;
206
208
207
209
group . appendChild ( a ) ;
208
210
return group ;
0 commit comments