@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering.
43 lines • 1.03 kB
JavaScript
import { Base } from '../base';
import { ObjectExt } from '../../util';
export function getMarkup(tagName, selector = 'body') {
return [
{
tagName,
selector,
},
{
tagName: 'text',
selector: 'label',
},
];
}
export const bodyAttr = {
fill: '#ffffff',
stroke: '#333333',
strokeWidth: 2,
};
export const labelAttr = {
fontSize: 14,
fill: '#333333',
refX: '50%',
refY: '50%',
textAnchor: 'middle',
textVerticalAnchor: 'middle',
};
export function createShape(shape, config, options = {}) {
const defaults = {
constructorName: shape,
markup: getMarkup(shape, options.selector),
attrs: {
[shape]: {
fill: '#ffffff',
stroke: '#333333',
strokeWidth: 2,
},
},
};
const base = options.parent || Base;
return base.define(ObjectExt.merge(defaults, config, { shape }));
}
//# sourceMappingURL=util.js.map