Skip to content

Commit 2b59e2c

Browse files
committed
Temp fix for yref=paper
1 parent e8e49a5 commit 2b59e2c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/plot_api/subroutines.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,6 @@ exports.drawMainTitle = function(gd) {
407407

408408
if(gd._fullLayout.title.automargin) {
409409
applyTitleAutoMargin(gd, fullLayout, dy);
410-
// A bit hacky to make sure top padding is properly accounted for
411-
y += gd._fullLayout.title.pad.t;
412410
}
413411

414412
Titles.draw(gd, 'gtitle', {
@@ -447,7 +445,7 @@ function applyTitleAutoMargin(gd, fullLayout, dy) {
447445
// TODO: Push titleDepth depending on yanchor?
448446
push[direction] = (
449447
titleDepth(title) +
450-
getMainTitleY(fullLayout, dy) +
448+
// getMainTitleY(fullLayout, dy) + // TODO: Why is this calculation triggering too many automargin redraws?
451449
title.pad.t +
452450
title.pad.b
453451
);

test/image/mocks/zzz-automargin-title.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
},
2626
"title": {
2727
"automargin": true,
28-
"text": "Some text",
29-
"y": 1,
30-
"yanchor": "top",
31-
"container": "paper"
28+
"text": "A sample title",
29+
"font": {"size": 24},
30+
"pad": {"t": 15},
31+
"yanchor": "bottom",
32+
"yref": "paper",
33+
"y": 1
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)