Make scaling basd on a list rather than hard-coded if-then statements. Issue #1324
This commit is contained in:
parent
1c938cc48e
commit
0e4b3f05e2
|
@ -1213,20 +1213,23 @@
|
|||
* Handle rescaling all the math
|
||||
*/
|
||||
MENU.Scale = function () {
|
||||
var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML,
|
||||
SVG = OUTPUT.SVG, CHTML = OUTPUT.CommonHTML;
|
||||
var SCALE = (CHTML||HTMLCSS||nMML||SVG||{config:{scale:100}}).config.scale;
|
||||
var JAX = ["CommonHTML","HTML-CSS","SVG","NativeMML","PreviewHTML"], m = JAX.length,
|
||||
SCALE = 100, i, jax;
|
||||
for (i = 0; i < m; i++) {
|
||||
jax = OUTPUT[JAX[i]];
|
||||
if (jax) {SCALE = jax.config.scale; break}
|
||||
}
|
||||
var scale = prompt(_("ScaleMath","Scale all mathematics (compared to surrounding text) by"),SCALE+"%");
|
||||
if (scale) {
|
||||
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
|
||||
scale = parseFloat(scale);
|
||||
if (scale) {
|
||||
if (scale !== SCALE) {
|
||||
if (HTMLCSS) {HTMLCSS.config.scale = scale}
|
||||
if (CHTML) {CHTML.config.scale = scale}
|
||||
if (nMML) {nMML.config.scale = scale}
|
||||
if (SVG) {SVG.config.scale = scale}
|
||||
MENU.cookie.scale = scale;
|
||||
for (i = 0; i < m; i++) {
|
||||
jax = OUTPUT[JAX[i]];
|
||||
if (jax) jax.config.scale = scale;
|
||||
}
|
||||
MENU.cookie.scale = HUB.config.scale = scale;
|
||||
MENU.saveCookie();
|
||||
HUB.Queue(["Rerender",HUB]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user