-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix mathjax placement in ternary aaxis titles #3513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@antoinerg or @archmoj could one of you review this thing at some point today? Thank you! |
src/lib/svg_text_utils.js
Outdated
@@ -134,7 +134,7 @@ exports.convertToTspans = function(_context, gd, _callback) { | |||
else if(svgClass[0] === 'l') { | |||
newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); | |||
} | |||
else if(svgClass[0] === 'a') { | |||
else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use
if(svgClass === 'atitle') {
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would that be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering of an edge case where 'atitle' appears in other position in the text.
Though I was not able find any word containing those letters in order!
Anyway could we use this condition instead to test if atitle
only occurs at the start of the string?
else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') !== 0) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Done in -> c7878b3
Thanks @etpinard for fixing this bug. |
fixes #3455 -- cc @plotly/plotly_js
I was really hoping to get rid of this hacky block
plotly.js/src/lib/svg_text_utils.js
Lines 127 to 142 in 84e24aa
entirely, but since our MathJax test coverage is lackluster, I chose the safe road.