msqrt.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.SVGmsqrt = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var msqrt_js_1 = require("../../common/Wrappers/msqrt.js");
  21. var msqrt_js_2 = require("../../../core/MmlTree/MmlNodes/msqrt.js");
  22. var SVGmsqrt = (function (_super) {
  23. __extends(SVGmsqrt, _super);
  24. function SVGmsqrt() {
  25. var _this = _super !== null && _super.apply(this, arguments) || this;
  26. _this.dx = 0;
  27. return _this;
  28. }
  29. SVGmsqrt.prototype.toSVG = function (parent) {
  30. var surd = this.childNodes[this.surd];
  31. var base = this.childNodes[this.base];
  32. var root = (this.root ? this.childNodes[this.root] : null);
  33. var sbox = surd.getBBox();
  34. var bbox = base.getOuterBBox();
  35. var q = this.getPQ(sbox)[1];
  36. var t = this.font.params.rule_thickness * this.bbox.scale;
  37. var H = bbox.h + q + t;
  38. var SVG = this.standardSVGnode(parent);
  39. var BASE = this.adaptor.append(SVG, this.svg('g'));
  40. this.addRoot(SVG, root, sbox, H);
  41. surd.toSVG(SVG);
  42. surd.place(this.dx, H - sbox.h);
  43. base.toSVG(BASE);
  44. base.place(this.dx + sbox.w, 0);
  45. this.adaptor.append(SVG, this.svg('rect', {
  46. width: this.fixed(bbox.w), height: this.fixed(t),
  47. x: this.fixed(this.dx + sbox.w), y: this.fixed(H - t)
  48. }));
  49. };
  50. SVGmsqrt.prototype.addRoot = function (_ROOT, _root, _sbox, _H) {
  51. };
  52. SVGmsqrt.kind = msqrt_js_2.MmlMsqrt.prototype.kind;
  53. return SVGmsqrt;
  54. }((0, msqrt_js_1.CommonMsqrtMixin)(Wrapper_js_1.SVGWrapper)));
  55. exports.SVGmsqrt = SVGmsqrt;
  56. //# sourceMappingURL=msqrt.js.map