Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66e503c

Browse files
committed
updatemenus: Fix image test failure
* Reduce scroll box minimum size from 44 to 25 pixels. * Allow scroll boxes to use the full width and height.
1 parent 5a4ecf3 commit 66e503c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/components/updatemenus/draw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ function drawButtons(gd, gHeader, gButton, menuOpts) {
308308

309309
button.on('click', function() {
310310
// skip `dragend` events
311-
if (d3.event.defaultPrevented) return;
311+
if(d3.event.defaultPrevented) return;
312312

313313
setActive(gd, menuOpts, buttonOpts, gHeader, gButton, buttonIndex);
314314

src/components/updatemenus/scrollbox.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,24 @@ ScrollBox.barColor = '#808BA4';
5252
ScrollBox.prototype.enable = function enable() {
5353
var fullLayout = this.gd._fullLayout,
5454
fullWidth = fullLayout.width,
55-
fullHeight = fullLayout.height,
56-
graphSize = fullLayout._size;
55+
fullHeight = fullLayout.height;
5756

5857
// compute position of scroll box
5958
var l = this.position.l,
6059
w = this.position.w,
6160
t = this.position.t,
6261
h = this.position.h,
63-
boxW = (w <= fullWidth) ? w : fullWidth - graphSize.r - l,
64-
boxH = (h <= fullHeight) ? h : fullHeight - graphSize.b - t,
62+
boxW = w,
63+
boxH = h,
6564
boxL, boxR,
6665
boxT, boxB;
6766

68-
var minSize = 2 * (ScrollBox.barLength + 2 * ScrollBox.barPad);
69-
if(boxW <= minSize || fullWidth < boxW) boxW = fullWidth / 4;
70-
if(boxH <= minSize || fullHeight < boxH) boxH = fullHeight / 4;
67+
if(boxW > fullWidth) boxW = fullWidth / 4;
68+
if(boxH > fullHeight) boxH = fullHeight / 4;
69+
70+
var minSize = 4 + (ScrollBox.barLength + 2 * ScrollBox.barPad);
71+
boxW = Math.max(boxW, minSize);
72+
boxH = Math.max(boxH, minSize);
7173

7274
if(0 <= l && l <= fullWidth) {
7375
boxL = l;

0 commit comments

Comments
 (0)