Skip to content

Commit 625ea53

Browse files
committed
fix subtitle placement when title is mathjax
1 parent 4a55ff2 commit 625ea53

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/titles/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ function draw(gd, titleClass, options) {
178178
transformVal = null;
179179
}
180180

181+
function adjustSubtitlePosition(titleElMathGroup) {
182+
if(titleElMathGroup && subtitleEl) {
183+
var titleHeight = titleElMathGroup.node().getBBox().height;
184+
var newSubtitleY = Number(subtitleEl.attr('y')) + titleHeight;
185+
subtitleEl.attr('y', newSubtitleY);
186+
}
187+
}
188+
181189
titleEl.attr('transform', transformVal);
182190

183191
titleEl.style('opacity', opacity * Color.opacity(fontColor))
@@ -193,7 +201,7 @@ function draw(gd, titleClass, options) {
193201
lineposition: fontLineposition,
194202
})
195203
.attr(attributes)
196-
.call(svgTextUtils.convertToTspans, gd);
204+
.call(svgTextUtils.convertToTspans, gd, adjustSubtitlePosition);
197205

198206
var subtitleAttributes = Object.assign({}, attributes);
199207
subtitleAttributes.y += Drawing.bBox(titleEl.node()).height;

0 commit comments

Comments
 (0)