@@ -368,7 +368,6 @@ function drawTexts(context, gd, d, i, traces) {
368
368
369
369
function repositionLegend ( gd , traces ) {
370
370
var fullLayout = gd . _fullLayout ,
371
- gs = fullLayout . _size ,
372
371
opts = fullLayout . legend ,
373
372
borderwidth = opts . borderwidth ;
374
373
@@ -432,39 +431,27 @@ function repositionLegend(gd, traces) {
432
431
. attr ( 'width' , ( gd . _context . editable ? 0 : opts . width ) + 40 ) ;
433
432
434
433
// now position the legend. for both x,y the positions are recorded as
435
- // fractions of the plot area (left, bottom = 0,0). Outside the plot
436
- // area is allowed but position will be clipped to the page.
437
- // values <1/3 align the low side at that fraction, 1/3-2/3 align the
438
- // center at that fraction, >2/3 align the right at that fraction
439
-
440
- var lx = gs . l + gs . w * opts . x ,
441
- ly = gs . t + gs . h * ( 1 - opts . y ) ;
434
+ // fractions of the plot area (left, bottom = 0,0).
442
435
443
436
var xanchor = 'left' ;
444
437
if ( anchorUtils . isRightAnchor ( opts ) ) {
445
- lx -= opts . width ;
446
438
xanchor = 'right' ;
447
439
}
448
440
if ( anchorUtils . isCenterAnchor ( opts ) ) {
449
- lx -= opts . width / 2 ;
450
441
xanchor = 'center' ;
451
442
}
452
443
453
444
var yanchor = 'top' ;
454
445
if ( anchorUtils . isBottomAnchor ( opts ) ) {
455
- ly -= opts . height ;
456
446
yanchor = 'bottom' ;
457
447
}
458
448
if ( anchorUtils . isMiddleAnchor ( opts ) ) {
459
- ly -= opts . height / 2 ;
460
449
yanchor = 'middle' ;
461
450
}
462
451
463
452
// make sure we're only getting full pixels
464
453
opts . width = Math . ceil ( opts . width ) ;
465
454
opts . height = Math . ceil ( opts . height ) ;
466
- lx = Math . round ( lx ) ;
467
- ly = Math . round ( ly ) ;
468
455
469
456
// lastly check if the margin auto-expand has changed
470
457
Plots . autoMargin ( gd , 'legend' , {
0 commit comments