Skip to content

Commit b9e388f

Browse files
committed
better text positioning in range-select buttons
1 parent 0d20931 commit b9e388f

File tree

1 file changed

+6
-6
lines changed
  • src/components/rangeselector

1 file changed

+6
-6
lines changed

src/components/rangeselector/draw.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ module.exports = function draw(gd) {
6666

6767
reposition(buttons, selectorLayout, fullLayout._size);
6868
});
69+
70+
// FAKE HARDCODED POSITION - PLZ REMOVE BEFORE MERGE
71+
selectors.attr('transform', 'translate(80, 60)');
6972
};
7073

7174
function makeSelectorData(gd) {
@@ -105,7 +108,7 @@ function drawButtonText(button, selectorLayout, d) {
105108
function textLayout(s) {
106109
svgTextUtils.convertToTspans(s, function() {
107110
// TODO do we need this???
108-
// if(gd.firstRender) repositionLegend(gd, traces);
111+
// if(gd.firstRender) repositionLegend(gd, traces);
109112
});
110113
}
111114

@@ -141,7 +144,7 @@ function reposition(buttons, opts, graphSize) {
141144
tHeight = opts.font.size * 1.3,
142145
tLines = tspans[0].length || 1;
143146

144-
var wEff = Math.min(tWidth + 10, 50),
147+
var wEff = Math.max(tWidth + 10, 30),
145148
hEff = Math.max(tHeight * tLines, 16) + 3;
146149

147150
// TODO add buttongap attribute
@@ -158,7 +161,7 @@ function reposition(buttons, opts, graphSize) {
158161

159162
var textAttr = {
160163
x: wEff / 2,
161-
y: tHeight * (1.5 - tLines / 2) // could do better
164+
y: tHeight * (1.5 - tLines / 2) - 2 // could do better
162165
};
163166

164167
text.attr(textAttr);
@@ -171,7 +174,4 @@ function reposition(buttons, opts, graphSize) {
171174
});
172175

173176
buttons.selectAll('rect').attr('height', opts.height);
174-
175-
176-
177177
}

0 commit comments

Comments
 (0)