TeXAtom.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. Object.defineProperty(exports, "__esModule", { value: true });
  18. exports.CHTMLTeXAtom = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var TeXAtom_js_1 = require("../../common/Wrappers/TeXAtom.js");
  21. var TeXAtom_js_2 = require("../../../core/MmlTree/MmlNodes/TeXAtom.js");
  22. var MmlNode_js_1 = require("../../../core/MmlTree/MmlNode.js");
  23. var CHTMLTeXAtom = (function (_super) {
  24. __extends(CHTMLTeXAtom, _super);
  25. function CHTMLTeXAtom() {
  26. return _super !== null && _super.apply(this, arguments) || this;
  27. }
  28. CHTMLTeXAtom.prototype.toCHTML = function (parent) {
  29. _super.prototype.toCHTML.call(this, parent);
  30. this.adaptor.setAttribute(this.chtml, 'texclass', MmlNode_js_1.TEXCLASSNAMES[this.node.texClass]);
  31. if (this.node.texClass === MmlNode_js_1.TEXCLASS.VCENTER) {
  32. var bbox = this.childNodes[0].getBBox();
  33. var h = bbox.h, d = bbox.d;
  34. var a = this.font.params.axis_height;
  35. var dh = ((h + d) / 2 + a) - h;
  36. this.adaptor.setStyle(this.chtml, 'verticalAlign', this.em(dh));
  37. }
  38. };
  39. CHTMLTeXAtom.kind = TeXAtom_js_2.TeXAtom.prototype.kind;
  40. return CHTMLTeXAtom;
  41. }((0, TeXAtom_js_1.CommonTeXAtomMixin)(Wrapper_js_1.CHTMLWrapper)));
  42. exports.CHTMLTeXAtom = CHTMLTeXAtom;
  43. //# sourceMappingURL=TeXAtom.js.map