mspace.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.CHTMLmspace = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var mspace_js_1 = require("../../common/Wrappers/mspace.js");
  21. var mspace_js_2 = require("../../../core/MmlTree/MmlNodes/mspace.js");
  22. var CHTMLmspace = (function (_super) {
  23. __extends(CHTMLmspace, _super);
  24. function CHTMLmspace() {
  25. return _super !== null && _super.apply(this, arguments) || this;
  26. }
  27. CHTMLmspace.prototype.toCHTML = function (parent) {
  28. var chtml = this.standardCHTMLnode(parent);
  29. var _a = this.getBBox(), w = _a.w, h = _a.h, d = _a.d;
  30. if (w < 0) {
  31. this.adaptor.setStyle(chtml, 'marginRight', this.em(w));
  32. w = 0;
  33. }
  34. if (w) {
  35. this.adaptor.setStyle(chtml, 'width', this.em(w));
  36. }
  37. h = Math.max(0, h + d);
  38. if (h) {
  39. this.adaptor.setStyle(chtml, 'height', this.em(Math.max(0, h)));
  40. }
  41. if (d) {
  42. this.adaptor.setStyle(chtml, 'verticalAlign', this.em(-d));
  43. }
  44. };
  45. CHTMLmspace.kind = mspace_js_2.MmlMspace.prototype.kind;
  46. return CHTMLmspace;
  47. }((0, mspace_js_1.CommonMspaceMixin)(Wrapper_js_1.CHTMLWrapper)));
  48. exports.CHTMLmspace = CHTMLmspace;
  49. //# sourceMappingURL=mspace.js.map