@visactor/vgrammar-core
Version:
VGrammar is a visual grammar library
39 lines (32 loc) • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.registerGlyphMark = exports.GlyphMark = void 0;
const enums_1 = require("../graph/enums"), graphic_1 = require("../graph/util/graphic"), mark_1 = require("./mark"), factory_1 = require("../core/factory"), glyph_element_1 = require("../graph/glyph-element");
class GlyphMark extends mark_1.Mark {
constructor(view, glyphType, group) {
super(view, enums_1.GrammarMarkType.glyph, group), this.glyphType = glyphType, this.glyphMeta = factory_1.Factory.getGlyph(glyphType);
}
configureGlyph(config) {
return this.spec.glyphConfig = config, this.commit(), this;
}
getGlyphMeta() {
return this.glyphMeta;
}
getGlyphConfig() {
return this.spec.glyphConfig;
}
addGraphicItem(attrs, groupKey) {
const graphicItem = (0, graphic_1.createGlyphGraphicItem)(this, this.glyphMeta, attrs);
return super.addGraphicItem(attrs, groupKey, graphicItem);
}
createElement() {
return new glyph_element_1.GlyphElement(this);
}
}
exports.GlyphMark = GlyphMark, GlyphMark.markType = enums_1.GrammarMarkType.glyph;
const registerGlyphMark = () => {
factory_1.Factory.registerMark(enums_1.GrammarMarkType.glyph, GlyphMark);
};
exports.registerGlyphMark = registerGlyphMark;
//# sourceMappingURL=glyph.js.map