Skip to content

Commit fcdf05a

Browse files
committed
generalize is-active modebar update,
- using nested property to dive into fullLayout
1 parent 089b335 commit fcdf05a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/modebar/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
'use strict';
1111

12-
var Plotly = require('../../plotly');
1312
var d3 = require('d3');
1413

14+
var Plotly = require('../../plotly');
15+
var Lib = require('../../lib');
1516
var Icons = require('../../../build/ploticon');
1617

1718

@@ -204,7 +205,11 @@ proto.updateActiveButton = function(buttonClicked) {
204205
}
205206
}
206207
else {
207-
button3.classed('active', fullLayout[dataAttr]===thisval);
208+
var val = (dataAttr === null) ?
209+
dataAttr :
210+
Lib.nestedProperty(fullLayout, dataAttr).get();
211+
212+
button3.classed('active', val === thisval);
208213
}
209214

210215
});
@@ -260,7 +265,7 @@ proto.removeAllButtons = function() {
260265
};
261266

262267
proto.destroy = function() {
263-
Plotly.Lib.removeElement(this.container.querySelector('.modebar'));
268+
Lib.removeElement(this.container.querySelector('.modebar'));
264269
};
265270

266271
function createModeBar(gd, buttons) {

0 commit comments

Comments
 (0)