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
|
* Handle rescaling all the math
|
||||||
*/
|
*/
|
||||||
MENU.Scale = function () {
|
MENU.Scale = function () {
|
||||||
var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML,
|
var JAX = ["CommonHTML","HTML-CSS","SVG","NativeMML","PreviewHTML"], m = JAX.length,
|
||||||
SVG = OUTPUT.SVG, CHTML = OUTPUT.CommonHTML;
|
SCALE = 100, i, jax;
|
||||||
var SCALE = (CHTML||HTMLCSS||nMML||SVG||{config:{scale:100}}).config.scale;
|
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+"%");
|
var scale = prompt(_("ScaleMath","Scale all mathematics (compared to surrounding text) by"),SCALE+"%");
|
||||||
if (scale) {
|
if (scale) {
|
||||||
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
|
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
|
||||||
scale = parseFloat(scale);
|
scale = parseFloat(scale);
|
||||||
if (scale) {
|
if (scale) {
|
||||||
if (scale !== SCALE) {
|
if (scale !== SCALE) {
|
||||||
if (HTMLCSS) {HTMLCSS.config.scale = scale}
|
for (i = 0; i < m; i++) {
|
||||||
if (CHTML) {CHTML.config.scale = scale}
|
jax = OUTPUT[JAX[i]];
|
||||||
if (nMML) {nMML.config.scale = scale}
|
if (jax) jax.config.scale = scale;
|
||||||
if (SVG) {SVG.config.scale = scale}
|
}
|
||||||
MENU.cookie.scale = scale;
|
MENU.cookie.scale = HUB.config.scale = scale;
|
||||||
MENU.saveCookie();
|
MENU.saveCookie();
|
||||||
HUB.Queue(["Rerender",HUB]);
|
HUB.Queue(["Rerender",HUB]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user