merror.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.SVGmerror = void 0;
  19. var Wrapper_js_1 = require("../Wrapper.js");
  20. var merror_js_1 = require("../../../core/MmlTree/MmlNodes/merror.js");
  21. var SVGmerror = (function (_super) {
  22. __extends(SVGmerror, _super);
  23. function SVGmerror() {
  24. return _super !== null && _super.apply(this, arguments) || this;
  25. }
  26. SVGmerror.prototype.toSVG = function (parent) {
  27. var svg = this.standardSVGnode(parent);
  28. var _a = this.getBBox(), h = _a.h, d = _a.d, w = _a.w;
  29. this.adaptor.append(this.element, this.svg('rect', {
  30. 'data-background': true,
  31. width: this.fixed(w), height: this.fixed(h + d), y: this.fixed(-d)
  32. }));
  33. var title = this.node.attributes.get('title');
  34. if (title) {
  35. this.adaptor.append(this.element, this.svg('title', {}, [this.adaptor.text(title)]));
  36. }
  37. this.addChildren(svg);
  38. };
  39. SVGmerror.kind = merror_js_1.MmlMerror.prototype.kind;
  40. SVGmerror.styles = {
  41. 'g[data-mml-node="merror"] > g': {
  42. fill: 'red',
  43. stroke: 'red'
  44. },
  45. 'g[data-mml-node="merror"] > rect[data-background]': {
  46. fill: 'yellow',
  47. stroke: 'none'
  48. }
  49. };
  50. return SVGmerror;
  51. }(Wrapper_js_1.SVGWrapper));
  52. exports.SVGmerror = SVGmerror;
  53. //# sourceMappingURL=merror.js.map