TeXAtom.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.CommonTeXAtomMixin = void 0;
  19. var MmlNode_js_1 = require("../../../core/MmlTree/MmlNode.js");
  20. function CommonTeXAtomMixin(Base) {
  21. return (function (_super) {
  22. __extends(class_1, _super);
  23. function class_1() {
  24. return _super !== null && _super.apply(this, arguments) || this;
  25. }
  26. class_1.prototype.computeBBox = function (bbox, recompute) {
  27. if (recompute === void 0) { recompute = false; }
  28. _super.prototype.computeBBox.call(this, bbox, recompute);
  29. if (this.childNodes[0] && this.childNodes[0].bbox.ic) {
  30. bbox.ic = this.childNodes[0].bbox.ic;
  31. }
  32. if (this.node.texClass === MmlNode_js_1.TEXCLASS.VCENTER) {
  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. bbox.h += dh;
  37. bbox.d -= dh;
  38. }
  39. };
  40. return class_1;
  41. }(Base));
  42. }
  43. exports.CommonTeXAtomMixin = CommonTeXAtomMixin;
  44. //# sourceMappingURL=TeXAtom.js.map