Make width of buttons in math dialog more flexible

Previously there were only two possible button widths,
now there are four.

Bug: T145613
Change-Id: I233f4f7c6cb810d6b5d54a5242514afed7c2ad9d
This commit is contained in:
Thalia 2016-10-13 19:04:37 -07:00
parent 6d83fb2569
commit 3ebade4175
3 changed files with 74 additions and 53 deletions

View File

@ -107,7 +107,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\exp_a", "tex": "\\exp_a",
"encapsulate": { "encapsulate": {
"pre": "\\exp_", "pre": "\\exp_",
@ -132,7 +132,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\log_{10}", "tex": "\\log_{10}",
"encapsulate": { "encapsulate": {
"pre": "\\log_{", "pre": "\\log_{",
@ -173,57 +173,61 @@
}, },
{ {
"insert": "\\arcsin", "insert": "\\arcsin",
"wide": true, "width": "wide",
"tex": "\\arcsin", "tex": "\\arcsin",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\arccos", "insert": "\\arccos",
"wide": true, "width": "wide",
"tex": "\\arccos", "tex": "\\arccos",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\arctan", "insert": "\\arctan",
"wide": true, "width": "wide",
"tex": "\\arctan", "tex": "\\arctan",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\arccot", "insert": "\\arccot",
"wide": true, "width": "wide",
"tex": "\\arccot", "tex": "\\arccot",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\arcsec", "insert": "\\arcsec",
"wide": true, "width": "wide",
"tex": "\\arcsec", "tex": "\\arcsec",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\arccsc", "insert": "\\arccsc",
"wide": true, "width": "wide",
"tex": "\\arccsc", "tex": "\\arccsc",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\sinh", "insert": "\\sinh",
"width": "wide",
"tex": "\\sinh", "tex": "\\sinh",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\cosh", "insert": "\\cosh",
"width": "wide",
"tex": "\\cosh", "tex": "\\cosh",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\tanh", "insert": "\\tanh",
"width": "wide",
"tex": "\\tanh", "tex": "\\tanh",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\coth", "insert": "\\coth",
"width": "wide",
"tex": "\\coth", "tex": "\\coth",
"alignBaseline": true "alignBaseline": true
}, },
@ -244,24 +248,25 @@
}, },
{ {
"insert": "\\operatorname{coth}", "insert": "\\operatorname{coth}",
"width": "wide",
"tex": "\\operatorname{coth}", "tex": "\\operatorname{coth}",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\operatorname{argsh}", "insert": "\\operatorname{argsh}",
"wide": true, "width": "wide",
"tex": "\\operatorname{argsh}", "tex": "\\operatorname{argsh}",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\operatorname{argch}", "insert": "\\operatorname{argch}",
"wide": true, "width": "wide",
"tex": "\\operatorname{argch}", "tex": "\\operatorname{argch}",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\operatorname{argth}", "insert": "\\operatorname{argth}",
"wide": true, "width": "wide",
"tex": "\\operatorname{argth}", "tex": "\\operatorname{argth}",
"alignBaseline": true "alignBaseline": true
}, },
@ -280,7 +285,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wider",
"tex": "\\min(x,y)", "tex": "\\min(x,y)",
"encapsulate": { "encapsulate": {
"pre": "\\min(", "pre": "\\min(",
@ -290,7 +295,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wider",
"tex": "\\max(x,y)", "tex": "\\max(x,y)",
"encapsulate": { "encapsulate": {
"pre": "\\max(", "pre": "\\max(",
@ -328,13 +333,13 @@
}, },
{ {
"insert": "\\liminf", "insert": "\\liminf",
"wide": true, "width": "wide",
"tex": "\\liminf", "tex": "\\liminf",
"alignBaseline": true "alignBaseline": true
}, },
{ {
"insert": "\\limsup", "insert": "\\limsup",
"wide": true, "width": "wide",
"tex": "\\limsup", "tex": "\\limsup",
"alignBaseline": true "alignBaseline": true
}, },
@ -367,6 +372,7 @@
}, },
{ {
"insert": "\\hom", "insert": "\\hom",
"width": "wide",
"tex": "\\hom", "tex": "\\hom",
"alignBaseline": true "alignBaseline": true
}, },
@ -404,12 +410,12 @@
}, },
{ {
"insert": "dy/dx", "insert": "dy/dx",
"wide": true, "width": "wider",
"tex": "dy/dx" "tex": "dy/dx"
}, },
{ {
"insert": "\\operatorname{d}\\!y/\\operatorname{d}\\!x", "insert": "\\operatorname{d}\\!y/\\operatorname{d}\\!x",
"wide": true, "width": "wider",
"tex": "\\operatorname{d}\\!y/\\operatorname{d}\\!x" "tex": "\\operatorname{d}\\!y/\\operatorname{d}\\!x"
}, },
{ {
@ -425,7 +431,7 @@
{ {
"insert": "{\\partial^2\\over\\partial x_1\\partial x_2}y", "insert": "{\\partial^2\\over\\partial x_1\\partial x_2}y",
"contain": true, "contain": true,
"wide": true, "width": "wider",
"tex": "{\\partial^2\\over\\partial x_1\\partial x_2}y" "tex": "{\\partial^2\\over\\partial x_1\\partial x_2}y"
}, },
{ {
@ -532,7 +538,7 @@
], ],
"math-visualeditor-symbol-group-modular": [ "math-visualeditor-symbol-group-modular": [
{ {
"wide": true, "width": "widest",
"tex": "\\pmod{m}", "tex": "\\pmod{m}",
"encapsulate": { "encapsulate": {
"pre": "\\pmod{", "pre": "\\pmod{",
@ -542,7 +548,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wider",
"tex": "a\\bmod b", "tex": "a\\bmod b",
"encapsulate": { "encapsulate": {
"pre": "", "pre": "",
@ -552,7 +558,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wider",
"tex": "\\gcd(m, n)", "tex": "\\gcd(m, n)",
"encapsulate": { "encapsulate": {
"pre": "\\gcd(", "pre": "\\gcd(",
@ -563,7 +569,7 @@
}, },
{ {
"insert": "\\operatorname{lcm}(m, n)", "insert": "\\operatorname{lcm}(m, n)",
"wide": true, "width": "wider",
"tex": "\\operatorname{lcm}(m, n)", "tex": "\\operatorname{lcm}(m, n)",
"encapsulate": { "encapsulate": {
"pre": "\\operatorname{lcm}(", "pre": "\\operatorname{lcm}(",
@ -2392,7 +2398,7 @@
], ],
"math-visualeditor-symbol-group-spacing": [ "math-visualeditor-symbol-group-spacing": [
{ {
"wide": true, "width": "wider",
"tex": "a \\qquad b", "tex": "a \\qquad b",
"encapsulate": { "encapsulate": {
"pre": "", "pre": "",
@ -2401,7 +2407,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "a \\quad b", "tex": "a \\quad b",
"encapsulate": { "encapsulate": {
"pre": "", "pre": "",
@ -2675,7 +2681,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{matrix} x & y \\\\ z & v \\end{matrix}", "tex": "\\begin{matrix} x & y \\\\ z & v \\end{matrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{matrix} ", "pre": "\\begin{matrix} ",
@ -2685,7 +2691,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{vmatrix} x & y \\\\ z & v \\end{vmatrix}", "tex": "\\begin{vmatrix} x & y \\\\ z & v \\end{vmatrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{vmatrix} ", "pre": "\\begin{vmatrix} ",
@ -2695,7 +2701,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{Vmatrix} x & y \\\\ z & v \\end{Vmatrix}", "tex": "\\begin{Vmatrix} x & y \\\\ z & v \\end{Vmatrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{Vmatrix} ", "pre": "\\begin{Vmatrix} ",
@ -2705,7 +2711,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{bmatrix} x & y \\\\ z & v \\end{bmatrix}", "tex": "\\begin{bmatrix} x & y \\\\ z & v \\end{bmatrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{bmatrix} ", "pre": "\\begin{bmatrix} ",
@ -2715,7 +2721,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{Bmatrix} x & y \\\\ z & v \\end{Bmatrix}", "tex": "\\begin{Bmatrix} x & y \\\\ z & v \\end{Bmatrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{Bmatrix} ", "pre": "\\begin{Bmatrix} ",
@ -2725,7 +2731,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{pmatrix} x & y \\\\ z & v \\end{pmatrix}", "tex": "\\begin{pmatrix} x & y \\\\ z & v \\end{pmatrix}",
"encapsulate": { "encapsulate": {
"pre": "\\begin{pmatrix} ", "pre": "\\begin{pmatrix} ",
@ -2734,7 +2740,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\bigl( \\begin{smallmatrix} x & y \\\\ z & v \\end{smallmatrix} \\bigr)", "tex": "\\bigl( \\begin{smallmatrix} x & y \\\\ z & v \\end{smallmatrix} \\bigr)",
"encapsulate": { "encapsulate": {
"pre": "\\bigl( \\begin{smallmatrix} ", "pre": "\\bigl( \\begin{smallmatrix} ",
@ -2773,6 +2779,7 @@
}, },
{ {
"tex": "a^{2+2}", "tex": "a^{2+2}",
"width": "wide",
"encapsulate": { "encapsulate": {
"pre": "", "pre": "",
"placeholder": "a", "placeholder": "a",
@ -2817,7 +2824,7 @@
"alignBaseline": true "alignBaseline": true
}, },
{ {
"wide": true, "width": "wide",
"tex": "10^{10^{8}}", "tex": "10^{10^{8}}",
"encapsulate": { "encapsulate": {
"pre": "", "pre": "",
@ -2828,7 +2835,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\sideset{_1^2}{_3^4}\\prod_a^b", "tex": "\\sideset{_1^2}{_3^4}\\prod_a^b",
"encapsulate": { "encapsulate": {
"pre": "\\sideset{_", "pre": "\\sideset{_",
@ -2867,6 +2874,7 @@
} }
}, },
{ {
"contain": true,
"tex": "\\stackrel{\\alpha}{\\omega}", "tex": "\\stackrel{\\alpha}{\\omega}",
"encapsulate": { "encapsulate": {
"pre": "\\stackrel{", "pre": "\\stackrel{",
@ -2957,7 +2965,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\textstyle \\sum_{k=1}^N", "tex": "\\textstyle \\sum_{k=1}^N",
"encapsulate": { "encapsulate": {
"pre": "\\textstyle \\sum_{", "pre": "\\textstyle \\sum_{",
@ -2989,7 +2997,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\textstyle \\prod_{i=1}^N", "tex": "\\textstyle \\prod_{i=1}^N",
"encapsulate": { "encapsulate": {
"pre": "\\textstyle \\prod_{", "pre": "\\textstyle \\prod_{",
@ -3011,7 +3019,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\textstyle \\coprod_{i=1}^N", "tex": "\\textstyle \\coprod_{i=1}^N",
"encapsulate": { "encapsulate": {
"pre": "\\textstyle \\coprod_{", "pre": "\\textstyle \\coprod_{",
@ -3020,6 +3028,7 @@
} }
}, },
{ {
"width": "wide",
"tex": "\\lim_{n \\to \\infty}", "tex": "\\lim_{n \\to \\infty}",
"encapsulate": { "encapsulate": {
"pre": "\\lim_{", "pre": "\\lim_{",
@ -3028,7 +3037,7 @@
} }
}, },
{ {
"wide": true, "width": "wider",
"tex": "\\textstyle \\lim_{n \\to \\infty}", "tex": "\\textstyle \\lim_{n \\to \\infty}",
"encapsulate": { "encapsulate": {
"pre": "\\textstyle \\lim_{", "pre": "\\textstyle \\lim_{",
@ -3073,7 +3082,7 @@
} }
}, },
{ {
"wide": true, "width": "wide",
"tex": "\\textstyle \\int_{-N}^{N} x", "tex": "\\textstyle \\int_{-N}^{N} x",
"encapsulate": { "encapsulate": {
"pre": "\\textstyle \\int_{", "pre": "\\textstyle \\int_{",
@ -3083,7 +3092,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\iint xy", "tex": "\\iint xy",
"encapsulate": { "encapsulate": {
"pre": "\\iint ", "pre": "\\iint ",
@ -3093,7 +3102,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\iint\\limits_D xy", "tex": "\\iint\\limits_D xy",
"encapsulate": { "encapsulate": {
"pre": "\\iint\\limits_", "pre": "\\iint\\limits_",
@ -3103,7 +3112,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\iiint xyz", "tex": "\\iiint xyz",
"encapsulate": { "encapsulate": {
"pre": "\\iiint ", "pre": "\\iiint ",
@ -3113,7 +3122,7 @@
}, },
{ {
"contain": true, "contain": true,
"wide": true, "width": "wider",
"tex": "\\iiiint xyzt", "tex": "\\iiiint xyzt",
"encapsulate": { "encapsulate": {
"pre": "\\iiiint ", "pre": "\\iiiint ",
@ -3154,39 +3163,39 @@
"insert": "f(n) = \\begin{cases} n/2, & \\text{if }n\\text{ is even} \\\\ 3n+1, & \\text{if }n\\text{ is odd} \\end{cases}", "insert": "f(n) = \\begin{cases} n/2, & \\text{if }n\\text{ is even} \\\\ 3n+1, & \\text{if }n\\text{ is odd} \\end{cases}",
"largeLayout": true, "largeLayout": true,
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "f(n) = \\begin{cases} n/2, & \\text{if }n\\text{ is even} \\\\ 3n+1, & \\text{if }n\\text{ is odd} \\end{cases}" "tex": "f(n) = \\begin{cases} n/2, & \\text{if }n\\text{ is even} \\\\ 3n+1, & \\text{if }n\\text{ is odd} \\end{cases}"
}, },
{ {
"insert": "\\begin{align} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{align}", "insert": "\\begin{align} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{align}",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "\\begin{align} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{align}" "tex": "\\begin{align} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{align}"
}, },
{ {
"insert": "\\begin{alignat}{2} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{alignat}", "insert": "\\begin{alignat}{2} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{alignat}",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "\\begin{alignat}{2} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{alignat}" "tex": "\\begin{alignat}{2} f(x) & = (a+b)^2 \\\\ & = a^2+2ab+b^2 \\\\ \\end{alignat}"
}, },
{ {
"insert": "\\begin{array}{lcl} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}", "insert": "\\begin{array}{lcl} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}",
"largeLayout": true, "largeLayout": true,
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{array}{lcl} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}" "tex": "\\begin{array}{lcl} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}"
}, },
{ {
"insert": "\\begin{array}{lcr} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}", "insert": "\\begin{array}{lcr} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}",
"largeLayout": true, "largeLayout": true,
"contain": true, "contain": true,
"wide": true, "width": "wide",
"tex": "\\begin{array}{lcr} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}" "tex": "\\begin{array}{lcr} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}"
}, },
{ {
"insert": "\\begin{cases} 3x + 5y + z \\\\ 7x - 2y + 4z \\\\ -6x + 3y + 2z \\end{cases}", "insert": "\\begin{cases} 3x + 5y + z \\\\ 7x - 2y + 4z \\\\ -6x + 3y + 2z \\end{cases}",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "\\begin{cases} 3x + 5y + z \\\\ 7x - 2y + 4z \\\\ -6x + 3y + 2z \\end{cases}" "tex": "\\begin{cases} 3x + 5y + z \\\\ 7x - 2y + 4z \\\\ -6x + 3y + 2z \\end{cases}"
}, },
{ {
@ -3198,19 +3207,19 @@
{ {
"insert": "A \\xleftarrow{n+\\mu-1} B \\xrightarrow[T]{n\\pm i-1} C", "insert": "A \\xleftarrow{n+\\mu-1} B \\xrightarrow[T]{n\\pm i-1} C",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "A \\xleftarrow{n+\\mu-1} B \\xrightarrow[T]{n\\pm i-1} C" "tex": "A \\xleftarrow{n+\\mu-1} B \\xrightarrow[T]{n\\pm i-1} C"
}, },
{ {
"insert": "\\overbrace{ 1+2+\\cdots+100 }^{5050}", "insert": "\\overbrace{ 1+2+\\cdots+100 }^{5050}",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "\\overbrace{ 1+2+\\cdots+100 }^{5050}" "tex": "\\overbrace{ 1+2+\\cdots+100 }^{5050}"
}, },
{ {
"insert": "\\underbrace{ a+b+\\cdots+z }_{26}", "insert": "\\underbrace{ a+b+\\cdots+z }_{26}",
"largeLayout": true, "largeLayout": true,
"wide": true, "width": "wide",
"tex": "\\underbrace{ a+b+\\cdots+z }_{26}" "tex": "\\underbrace{ a+b+\\cdots+z }_{26}"
} }
] ]

View File

@ -54,9 +54,20 @@
} }
.ve-ui-mwMathPage-symbol-wide { .ve-ui-mwMathPage-symbol-wide {
/* 2(symbol width) + margin */
width: 3.7em;
}
.ve-ui-mwMathPage-symbol-wider {
/* 2.5(symbol width) + 1.5(margin) */
width: 4.65em; width: 4.65em;
} }
.ve-ui-mwMathPage-symbol-widest {
/* 3(symbol width) + 2(margin) */
width: 5.6em;
}
.ve-ui-mwMathPage-symbol-contain { .ve-ui-mwMathPage-symbol-contain {
background-size: contain; /* stylelint-disable-line no-unsupported-browser-features */ background-size: contain; /* stylelint-disable-line no-unsupported-browser-features */
} }
@ -67,6 +78,7 @@
} }
.ve-ui-mwMathPage-symbol-largeLayout.ve-ui-mwMathPage-symbol-wide { .ve-ui-mwMathPage-symbol-largeLayout.ve-ui-mwMathPage-symbol-wide {
/* 5(symbol width) + 4(margin) */
width: 9.4em; width: 9.4em;
} }

View File

@ -40,8 +40,8 @@ ve.ui.MWMathPage = function VeUiMWMathPage( name, config ) {
return '_' + c.charCodeAt( 0 ) + '_'; return '_' + c.charCodeAt( 0 ) + '_';
} ) } )
); );
if ( symbol.wide ) { if ( symbol.width ) {
classes.push( 've-ui-mwMathPage-symbol-wide' ); classes.push( 've-ui-mwMathPage-symbol-' + symbol.width );
} }
if ( symbol.contain ) { if ( symbol.contain ) {
classes.push( 've-ui-mwMathPage-symbol-contain' ); classes.push( 've-ui-mwMathPage-symbol-contain' );