site/node_modules/mathjax-full/js/output/chtml/Wrappers/munderover.js

152 lines
6.9 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CHTMLmunderover = exports.CHTMLmover = exports.CHTMLmunder = void 0;
var msubsup_js_1 = require("./msubsup.js");
var munderover_js_1 = require("../../common/Wrappers/munderover.js");
var munderover_js_2 = require("../../common/Wrappers/munderover.js");
var munderover_js_3 = require("../../common/Wrappers/munderover.js");
var munderover_js_4 = require("../../../core/MmlTree/MmlNodes/munderover.js");
var CHTMLmunder = (function (_super) {
__extends(CHTMLmunder, _super);
function CHTMLmunder() {
return _super !== null && _super.apply(this, arguments) || this;
}
CHTMLmunder.prototype.toCHTML = function (parent) {
if (this.hasMovableLimits()) {
_super.prototype.toCHTML.call(this, parent);
this.adaptor.setAttribute(this.chtml, 'limits', 'false');
return;
}
this.chtml = this.standardCHTMLnode(parent);
var base = this.adaptor.append(this.adaptor.append(this.chtml, this.html('mjx-row')), this.html('mjx-base'));
var under = this.adaptor.append(this.adaptor.append(this.chtml, this.html('mjx-row')), this.html('mjx-under'));
this.baseChild.toCHTML(base);
this.scriptChild.toCHTML(under);
var basebox = this.baseChild.getOuterBBox();
var underbox = this.scriptChild.getOuterBBox();
var k = this.getUnderKV(basebox, underbox)[0];
var delta = (this.isLineBelow ? 0 : this.getDelta(true));
this.adaptor.setStyle(under, 'paddingTop', this.em(k));
this.setDeltaW([base, under], this.getDeltaW([basebox, underbox], [0, -delta]));
this.adjustUnderDepth(under, underbox);
};
CHTMLmunder.kind = munderover_js_4.MmlMunder.prototype.kind;
CHTMLmunder.styles = {
'mjx-over': {
'text-align': 'left'
},
'mjx-munder:not([limits="false"])': {
display: 'inline-table',
},
'mjx-munder > mjx-row': {
'text-align': 'left'
},
'mjx-under': {
'padding-bottom': '.1em'
}
};
return CHTMLmunder;
}((0, munderover_js_1.CommonMunderMixin)(msubsup_js_1.CHTMLmsub)));
exports.CHTMLmunder = CHTMLmunder;
var CHTMLmover = (function (_super) {
__extends(CHTMLmover, _super);
function CHTMLmover() {
return _super !== null && _super.apply(this, arguments) || this;
}
CHTMLmover.prototype.toCHTML = function (parent) {
if (this.hasMovableLimits()) {
_super.prototype.toCHTML.call(this, parent);
this.adaptor.setAttribute(this.chtml, 'limits', 'false');
return;
}
this.chtml = this.standardCHTMLnode(parent);
var over = this.adaptor.append(this.chtml, this.html('mjx-over'));
var base = this.adaptor.append(this.chtml, this.html('mjx-base'));
this.scriptChild.toCHTML(over);
this.baseChild.toCHTML(base);
var overbox = this.scriptChild.getOuterBBox();
var basebox = this.baseChild.getOuterBBox();
this.adjustBaseHeight(base, basebox);
var k = this.getOverKU(basebox, overbox)[0];
var delta = (this.isLineAbove ? 0 : this.getDelta());
this.adaptor.setStyle(over, 'paddingBottom', this.em(k));
this.setDeltaW([base, over], this.getDeltaW([basebox, overbox], [0, delta]));
this.adjustOverDepth(over, overbox);
};
CHTMLmover.kind = munderover_js_4.MmlMover.prototype.kind;
CHTMLmover.styles = {
'mjx-mover:not([limits="false"])': {
'padding-top': '.1em'
},
'mjx-mover:not([limits="false"]) > *': {
display: 'block',
'text-align': 'left'
}
};
return CHTMLmover;
}((0, munderover_js_2.CommonMoverMixin)(msubsup_js_1.CHTMLmsup)));
exports.CHTMLmover = CHTMLmover;
var CHTMLmunderover = (function (_super) {
__extends(CHTMLmunderover, _super);
function CHTMLmunderover() {
return _super !== null && _super.apply(this, arguments) || this;
}
CHTMLmunderover.prototype.toCHTML = function (parent) {
if (this.hasMovableLimits()) {
_super.prototype.toCHTML.call(this, parent);
this.adaptor.setAttribute(this.chtml, 'limits', 'false');
return;
}
this.chtml = this.standardCHTMLnode(parent);
var over = this.adaptor.append(this.chtml, this.html('mjx-over'));
var table = this.adaptor.append(this.adaptor.append(this.chtml, this.html('mjx-box')), this.html('mjx-munder'));
var base = this.adaptor.append(this.adaptor.append(table, this.html('mjx-row')), this.html('mjx-base'));
var under = this.adaptor.append(this.adaptor.append(table, this.html('mjx-row')), this.html('mjx-under'));
this.overChild.toCHTML(over);
this.baseChild.toCHTML(base);
this.underChild.toCHTML(under);
var overbox = this.overChild.getOuterBBox();
var basebox = this.baseChild.getOuterBBox();
var underbox = this.underChild.getOuterBBox();
this.adjustBaseHeight(base, basebox);
var ok = this.getOverKU(basebox, overbox)[0];
var uk = this.getUnderKV(basebox, underbox)[0];
var delta = this.getDelta();
this.adaptor.setStyle(over, 'paddingBottom', this.em(ok));
this.adaptor.setStyle(under, 'paddingTop', this.em(uk));
this.setDeltaW([base, under, over], this.getDeltaW([basebox, underbox, overbox], [0, this.isLineBelow ? 0 : -delta, this.isLineAbove ? 0 : delta]));
this.adjustOverDepth(over, overbox);
this.adjustUnderDepth(under, underbox);
};
CHTMLmunderover.prototype.markUsed = function () {
_super.prototype.markUsed.call(this);
this.jax.wrapperUsage.add(msubsup_js_1.CHTMLmsubsup.kind);
};
CHTMLmunderover.kind = munderover_js_4.MmlMunderover.prototype.kind;
CHTMLmunderover.styles = {
'mjx-munderover:not([limits="false"])': {
'padding-top': '.1em'
},
'mjx-munderover:not([limits="false"]) > *': {
display: 'block'
},
};
return CHTMLmunderover;
}((0, munderover_js_3.CommonMunderoverMixin)(msubsup_js_1.CHTMLmsubsup)));
exports.CHTMLmunderover = CHTMLmunderover;
//# sourceMappingURL=munderover.js.map