Skip to content

Commit e1effce

Browse files
committed
Honour the scrollbar margin
1 parent a05080d commit e1effce

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/components/legend/draw.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,24 @@ module.exports = function draw(gd) {
251251
// If scrollbar should be shown.
252252
if(opts.height - legendHeight > 0 && !gd._context.staticPlot) {
253253

254+
// increase the background and clip-path width
255+
// by the scrollbar width and margin
254256
bg.attr({
255-
width: opts.width - 2 * opts.borderwidth + constants.scrollBarWidth
257+
width: opts.width -
258+
2 * opts.borderwidth +
259+
constants.scrollBarWidth +
260+
constants.scrollBarMargin
256261
});
257262

258263
clipPath.select('rect').attr({
259-
width: opts.width + constants.scrollBarWidth
264+
width: opts.width +
265+
constants.scrollBarWidth +
266+
constants.scrollBarMargin
260267
});
261268

262269
if(gd.firstRender) {
263270
// Move scrollbar to starting position
264-
scrollBar.call(
265-
Drawing.setRect,
266-
opts.width - constants.scrollBarMargin,
267-
constants.scrollBarMargin,
268-
constants.scrollBarWidth,
269-
constants.scrollBarHeight
270-
);
271-
scrollBox.attr('data-scroll',0);
271+
scrollHandler(constants.scrollBarMargin, 0);
272272
}
273273

274274
var scrollBarYMax = legendHeight -
@@ -315,7 +315,7 @@ module.exports = function draw(gd) {
315315
scrollBox.attr('transform', 'translate(0, ' + scrollBoxY + ')');
316316
scrollBar.call(
317317
Drawing.setRect,
318-
opts.width - constants.scrollBarMargin,
318+
opts.width,
319319
scrollBarY,
320320
constants.scrollBarWidth,
321321
constants.scrollBarHeight

0 commit comments

Comments
 (0)