munderover.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. var __read = (this && this.__read) || function (o, n) {
  18. var m = typeof Symbol === "function" && o[Symbol.iterator];
  19. if (!m) return o;
  20. var i = m.call(o), r, ar = [], e;
  21. try {
  22. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  23. }
  24. catch (error) { e = { error: error }; }
  25. finally {
  26. try {
  27. if (r && !r.done && (m = i["return"])) m.call(i);
  28. }
  29. finally { if (e) throw e.error; }
  30. }
  31. return ar;
  32. };
  33. Object.defineProperty(exports, "__esModule", { value: true });
  34. exports.SVGmunderover = exports.SVGmover = exports.SVGmunder = void 0;
  35. var msubsup_js_1 = require("./msubsup.js");
  36. var munderover_js_1 = require("../../common/Wrappers/munderover.js");
  37. var munderover_js_2 = require("../../common/Wrappers/munderover.js");
  38. var munderover_js_3 = require("../../common/Wrappers/munderover.js");
  39. var munderover_js_4 = require("../../../core/MmlTree/MmlNodes/munderover.js");
  40. var SVGmunder = (function (_super) {
  41. __extends(SVGmunder, _super);
  42. function SVGmunder() {
  43. return _super !== null && _super.apply(this, arguments) || this;
  44. }
  45. SVGmunder.prototype.toSVG = function (parent) {
  46. if (this.hasMovableLimits()) {
  47. _super.prototype.toSVG.call(this, parent);
  48. return;
  49. }
  50. var svg = this.standardSVGnode(parent);
  51. var _a = __read([this.baseChild, this.scriptChild], 2), base = _a[0], script = _a[1];
  52. var _b = __read([base.getOuterBBox(), script.getOuterBBox()], 2), bbox = _b[0], sbox = _b[1];
  53. base.toSVG(svg);
  54. script.toSVG(svg);
  55. var delta = (this.isLineBelow ? 0 : this.getDelta(true));
  56. var v = this.getUnderKV(bbox, sbox)[1];
  57. var _c = __read(this.getDeltaW([bbox, sbox], [0, -delta]), 2), bx = _c[0], sx = _c[1];
  58. base.place(bx, 0);
  59. script.place(sx, v);
  60. };
  61. SVGmunder.kind = munderover_js_4.MmlMunder.prototype.kind;
  62. return SVGmunder;
  63. }((0, munderover_js_1.CommonMunderMixin)(msubsup_js_1.SVGmsub)));
  64. exports.SVGmunder = SVGmunder;
  65. var SVGmover = (function (_super) {
  66. __extends(SVGmover, _super);
  67. function SVGmover() {
  68. return _super !== null && _super.apply(this, arguments) || this;
  69. }
  70. SVGmover.prototype.toSVG = function (parent) {
  71. if (this.hasMovableLimits()) {
  72. _super.prototype.toSVG.call(this, parent);
  73. return;
  74. }
  75. var svg = this.standardSVGnode(parent);
  76. var _a = __read([this.baseChild, this.scriptChild], 2), base = _a[0], script = _a[1];
  77. var _b = __read([base.getOuterBBox(), script.getOuterBBox()], 2), bbox = _b[0], sbox = _b[1];
  78. base.toSVG(svg);
  79. script.toSVG(svg);
  80. var delta = (this.isLineAbove ? 0 : this.getDelta());
  81. var u = this.getOverKU(bbox, sbox)[1];
  82. var _c = __read(this.getDeltaW([bbox, sbox], [0, delta]), 2), bx = _c[0], sx = _c[1];
  83. base.place(bx, 0);
  84. script.place(sx, u);
  85. };
  86. SVGmover.kind = munderover_js_4.MmlMover.prototype.kind;
  87. return SVGmover;
  88. }((0, munderover_js_2.CommonMoverMixin)(msubsup_js_1.SVGmsup)));
  89. exports.SVGmover = SVGmover;
  90. var SVGmunderover = (function (_super) {
  91. __extends(SVGmunderover, _super);
  92. function SVGmunderover() {
  93. return _super !== null && _super.apply(this, arguments) || this;
  94. }
  95. SVGmunderover.prototype.toSVG = function (parent) {
  96. if (this.hasMovableLimits()) {
  97. _super.prototype.toSVG.call(this, parent);
  98. return;
  99. }
  100. var svg = this.standardSVGnode(parent);
  101. var _a = __read([this.baseChild, this.overChild, this.underChild], 3), base = _a[0], over = _a[1], under = _a[2];
  102. var _b = __read([base.getOuterBBox(), over.getOuterBBox(), under.getOuterBBox()], 3), bbox = _b[0], obox = _b[1], ubox = _b[2];
  103. base.toSVG(svg);
  104. under.toSVG(svg);
  105. over.toSVG(svg);
  106. var delta = this.getDelta();
  107. var u = this.getOverKU(bbox, obox)[1];
  108. var v = this.getUnderKV(bbox, ubox)[1];
  109. var _c = __read(this.getDeltaW([bbox, ubox, obox], [0, this.isLineBelow ? 0 : -delta, this.isLineAbove ? 0 : delta]), 3), bx = _c[0], ux = _c[1], ox = _c[2];
  110. base.place(bx, 0);
  111. under.place(ux, v);
  112. over.place(ox, u);
  113. };
  114. SVGmunderover.kind = munderover_js_4.MmlMunderover.prototype.kind;
  115. return SVGmunderover;
  116. }((0, munderover_js_3.CommonMunderoverMixin)(msubsup_js_1.SVGmsubsup)));
  117. exports.SVGmunderover = SVGmunderover;
  118. //# sourceMappingURL=munderover.js.map