Skip to content

Commit fb6adc3

Browse files
committed
Add showactive attribute to buttons
1 parent 28fff11 commit fb6adc3

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/components/updatemenus/attributes.js

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ module.exports = {
9999
].join(' ')
100100
},
101101

102+
showactive: {
103+
valType: 'boolean',
104+
role: 'info',
105+
dflt: true,
106+
description: 'Highlights active dropdown item or active button if true.'
107+
},
108+
102109
buttons: buttonsAttrs,
103110

104111
x: {

src/components/updatemenus/defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function menuDefaults(menuIn, menuOut, layoutOut) {
5252
coerce('orientation');
5353
coerce('type');
5454
coerce('openreverse');
55+
coerce('showactive');
5556

5657
coerce('x');
5758
coerce('y');

src/components/updatemenus/draw.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function styleButtons(buttons, menuOpts) {
363363
buttons.each(function(buttonOpts, i) {
364364
var button = d3.select(this);
365365

366-
if(i === active) {
366+
if(i === active && menuOpts.showactive) {
367367
button.select('rect.' + constants.itemRectClassName)
368368
.call(Color.fill, constants.activeColor);
369369
}
@@ -417,6 +417,9 @@ function findDimenstions(gd, menuOpts) {
417417
tLines = tspans[0].length || 1,
418418
hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY;
419419

420+
hEff = Math.ceil(hEff);
421+
wEff = Math.ceil(wEff);
422+
420423
// Store per-item sizes since a row of horizontal buttons, for example,
421424
// don't all need to be the same width:
422425
menuOpts.widths[i] = wEff;

0 commit comments

Comments
 (0)