Skip to content
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

Improve CSS for stretchy braces in IE and Edge #73

Merged
merged 5 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions mathjax3-ts/output/chtml/Wrappers/mo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,18 @@ export class CHTMLmo extends CHTMLWrapper {
'mjx-stretchy-v': {
display: 'inline-block'
},
'mjx-stretchy-v > *': {
display: 'block'
},
'mjx-stretchy-v > mjx-beg': {
display: 'block',
height: 0
},
'mjx-stretchy-v > mjx-end': {
display: 'block'
},
'mjx-stretchy-v > mjx-end > mjx-c': {
display: 'block'
},
'mjx-stretchy-v > mjx-beg > mjx-c, mjx-stretchy-v > mjx-end > mjx-c': {
'mjx-stretchy-v > * > mjx-c': {
transform: 'scale(1)', // improves Firefox positioning
'transform-origin': 'left center',
overflow: 'hidden'
},
'mjx-stretchy-v > mjx-ext': {
Expand All @@ -101,7 +102,8 @@ export class CHTMLmo extends CHTMLWrapper {
overflow: 'hidden'
},
'mjx-stretchy-v > mjx-ext > mjx-c': {
transform: 'scaleY(500) translateY(.1em)'
transform: 'scaleY(500) translateY(.1em)',
overflow: 'visible'
},
'mjx-mark': {
display: 'inline-block',
Expand Down
10 changes: 6 additions & 4 deletions mathjax3-ts/output/chtml/fonts/tex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,9 @@ export class TeXFont extends FontData {
const Hb = this.addDelimiterVPart(styles, c, 'beg', beg);
this.addDelimiterVPart(styles, c, 'ext', ext);
const He = this.addDelimiterVPart(styles, c, 'end', end);
let Hm;
if (mid) {
this.addDelimiterVPart(styles, c, 'mid', mid);
Hm = this.addDelimiterVPart(styles, c, 'mid', mid);
styles['.MJX-TEX mjx-stretchy-v[c="' + c + '"] > mjx-ext'] = {height: '50%'}
}
const css: StyleData = {};
Expand All @@ -414,10 +415,11 @@ export class TeXFont extends FontData {
}
if (He) {
css['border-bottom-width'] = this.em0(He - .03);
css['margin-bottom'] = this.em(-He);
styles['.MJX-TEX mjx-stretchy-v[c="' + c + '"] > mjx-end'] = {'margin-top': this.em(-He)};
if (mid) {
styles['.MJX-TEX mjx-stretchy-v[c="' + c + '"] > mjx-ext:last-of-type'] = {
'margin-top': this.em(-He)
styles['.MJX-TEX mjx-stretchy-v[c="' + c + '"] > mjx-mid'] = {
'margin-top': this.em(-Hm/2),
'margin-bottom': this.em(-Hm/2)
Copy link
Member

Choose a reason for hiding this comment

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

Why can't the mid case from lines 407-411 be handled here?
Can we ever get a mid part without end part?
Or is it important that the styles is set earlier?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why it is in the location. Probably due to doing one part at one time and the other at later time. I've moved them to the same location and tidied up a bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see why it was the way. The original CSS was for a different element, but was changed to the mid element, and I didn't catch that it could be moved earlier.

};
}
}
Expand Down