Skip to content

Commit 387e7da

Browse files
committed
require Icons in modebar index directly,
instead of relying on internal Plotly.
1 parent 84a7c06 commit 387e7da

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/components/modebar/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
var Plotly = require('../../plotly');
1313
var d3 = require('d3');
1414

15+
var Icons = require('../../../build/ploticon');
1516
var modebarConfig = require('./modebar_config');
17+
18+
1619
/**
1720
* UI controller for interactive plots
1821
* @Class
@@ -108,7 +111,7 @@ proto.createButton = function (config) {
108111
button.setAttribute('data-toggle', config.toggle);
109112
if(config.toggle) button.classList.add('active');
110113

111-
button.appendChild(this.createIcon(Plotly.Icons[config.icon]));
114+
button.appendChild(this.createIcon(Icons[config.icon]));
112115

113116
return button;
114117
};
@@ -121,8 +124,7 @@ proto.createButton = function (config) {
121124
* @Return {HTMLelement}
122125
*/
123126
proto.createIcon = function (thisIcon) {
124-
var iconDef = Plotly.Icons,
125-
iconHeight = iconDef.ascent - iconDef.descent,
127+
var iconHeight = Icons.ascent - Icons.descent,
126128
svgNS = 'http://www.w3.org/2000/svg',
127129
icon = document.createElementNS(svgNS, 'svg'),
128130
path = document.createElementNS(svgNS, 'path');
@@ -132,7 +134,7 @@ proto.createIcon = function (thisIcon) {
132134
icon.setAttribute('viewBox', [0, 0, thisIcon.width, iconHeight].join(' '));
133135

134136
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 + ')');
136138
icon.appendChild(path);
137139

138140
return icon;
@@ -202,7 +204,7 @@ proto.getLogo = function(){
202204
a.setAttribute('data-title', 'Produced with Plotly');
203205
a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
204206

205-
a.appendChild(this.createIcon(Plotly.Icons.plotlylogo));
207+
a.appendChild(this.createIcon(Icons.plotlylogo));
206208

207209
group.appendChild(a);
208210
return group;

src/plotly.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ exports.Lib = require('./lib');
2525
exports.util = require('./lib/svg_text_utils');
2626
exports.Queue = require('./lib/queue');
2727

28-
// plot icons svg and plot css
29-
exports.Icons = require('../build/ploticon');
28+
// plot css
3029
require('../build/plotcss');
3130

3231
// configuration

0 commit comments

Comments
 (0)