Skip to content

Commit 7f71b53

Browse files
committed
Fix computation of lowest possible legend position
1 parent cedabd3 commit 7f71b53

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/components/legend/draw.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ module.exports = function draw(gd) {
201201
// Make sure the legend top and bottom are visible
202202
// (legends with a scroll bar are not allowed to stretch beyond the extended
203203
// margins)
204-
var lyMin = 0;
205-
var lyMax = fullLayout.margin.t + fullLayout.height + fullLayout.margin.b;
206-
var legendHeight = opts.height;
207-
var legendHeightMax = gs.h;
204+
var lyMin = 0,
205+
lyMax = fullLayout.height,
206+
legendHeight = opts.height,
207+
legendHeightMax = gs.h;
208208

209209

210210
if(legendHeight > legendHeightMax) {
@@ -220,9 +220,7 @@ module.exports = function draw(gd) {
220220
}
221221

222222
// Deal with scrolling
223-
var scrollPosition = scrollBox.attr('data-scroll') ?
224-
scrollBox.attr('data-scroll') :
225-
0;
223+
var scrollPosition = scrollBox.attr('data-scroll') || 0;
226224

227225
scrollBox.attr('transform', 'translate(0, ' + scrollPosition + ')');
228226

0 commit comments

Comments
 (0)