Skip to content

Commit

Permalink
feat: shapes with string markup
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Feb 27, 2020
1 parent ed4ff25 commit f9e5439
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/x6/src/research/shape/basic.ts
@@ -1,4 +1,5 @@
import { Node } from '../core/node'
import { registerNode } from '../registry/node'

function getMarkup(tagName: string) {
return `<g class="rotatable"><g class="scalable"><${tagName}/></g><text/></g>`
Expand All @@ -24,6 +25,24 @@ const shapeAttr = {
stroke: '#000000',
}

// tslint:disable-next-line
export const Rect1 = registerNode('rect', {
markup: getMarkup('rect'),
attrs: {
...commonAttr,
rect: {
...shapeAttr,
width: 100,
height: 60,
},
text: {
...textAttr,
refX: 0.5,
refY: 0.5,
},
},
})

export class Rect extends Node {}
Rect.setDefaults({
markup: getMarkup('rect'),
Expand Down

0 comments on commit f9e5439

Please sign in to comment.