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

82 lines
3.4 KiB
JavaScript
Raw 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 __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CHTMLinferredMrow = exports.CHTMLmrow = void 0;
var Wrapper_js_1 = require("../Wrapper.js");
var mrow_js_1 = require("../../common/Wrappers/mrow.js");
var mrow_js_2 = require("../../common/Wrappers/mrow.js");
var mrow_js_3 = require("../../../core/MmlTree/MmlNodes/mrow.js");
var CHTMLmrow = (function (_super) {
__extends(CHTMLmrow, _super);
function CHTMLmrow() {
return _super !== null && _super.apply(this, arguments) || this;
}
CHTMLmrow.prototype.toCHTML = function (parent) {
var e_1, _a;
var chtml = (this.node.isInferred ? (this.chtml = parent) : this.standardCHTMLnode(parent));
var hasNegative = false;
try {
for (var _b = __values(this.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
child.toCHTML(chtml);
if (child.bbox.w < 0) {
hasNegative = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
if (hasNegative) {
var w = this.getBBox().w;
if (w) {
this.adaptor.setStyle(chtml, 'width', this.em(Math.max(0, w)));
if (w < 0) {
this.adaptor.setStyle(chtml, 'marginRight', this.em(w));
}
}
}
};
CHTMLmrow.kind = mrow_js_3.MmlMrow.prototype.kind;
return CHTMLmrow;
}((0, mrow_js_1.CommonMrowMixin)(Wrapper_js_1.CHTMLWrapper)));
exports.CHTMLmrow = CHTMLmrow;
var CHTMLinferredMrow = (function (_super) {
__extends(CHTMLinferredMrow, _super);
function CHTMLinferredMrow() {
return _super !== null && _super.apply(this, arguments) || this;
}
CHTMLinferredMrow.kind = mrow_js_3.MmlInferredMrow.prototype.kind;
return CHTMLinferredMrow;
}((0, mrow_js_2.CommonInferredMrowMixin)(CHTMLmrow)));
exports.CHTMLinferredMrow = CHTMLinferredMrow;
//# sourceMappingURL=mrow.js.map