Skip to content

Make sure 0 remains 0 when rounding to pixels (plus a bit). #1461

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

Merged
merged 2 commits into from
May 17, 2016

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented May 4, 2016

Make sure rounded pixel values (which have a slight bit extra added to them) don't have the extra added to them when they are near 0. Resolves issue #1452.

@@ -2937,7 +2937,9 @@
// Add the width to the span (outside the MathJax class, so uses outer em size,
// which makes it work even when minimum font size is in effect).
//
span.style.width = HTMLCSS.Em(Math.max(0,Math.round(math.bbox.w*this.em)+.25)/HTMLCSS.outerEm);
var W = math.bbox.w;
if (Math.abs(W) < .006) W = 0; else W = Math.max(0,Math.round(W*this.em)+.25);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W = Math.abs(W) < .006 ? 0 : Math.max(0,Math.round(W*this.em)+.25);

For readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@dpvc
Copy link
Member Author

dpvc commented May 12, 2016

Made your suggested change.

@pkra pkra added this to the MathJax v2.x.x milestone May 17, 2016
@zorkow
Copy link
Member

zorkow commented May 17, 2016

lgtm.

@dpvc dpvc merged commit 2649818 into mathjax:develop May 17, 2016
@dpvc dpvc deleted the issue1452 branch May 17, 2016 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants