【发布时间】:2016-09-21 14:47:37
【问题描述】:
我在 Rappid/jointJS 中遇到问题
我在 stencil.js 中有 4 个形状(2 个 basic.Circle 和 2 个 basic.Rect),名称为 START(basic.Circle)、END(basic.Circle)、Activity(basic.Rect) 和 Workitem(basic.Rect ) 和 我想 在我的 main.js 从我的所有图表中获取带有名称(我的意思是带有 attrs 文本)“活动”的基本形状。
这是“活动”的 Stencil 描述:
new joint.shapes.basic.Rect({ size: { width: 5, height: 3 },
attrs: {
rect: {
rx: 2, ry: 2, width: 50, height: 30,
fill: '#0000FF'
},
text: { text: 'Activity', fill: '#ffffff', 'font-size': 10,
stroke: '#000000', 'stroke-width': 0 }
}
}),
我将如何获得它?到目前为止,我可以在图表中搜索的唯一方法是单元格的类型为 basic.Circle(使用get('type') === 'basic.Circle'))。但是对于 Circle 类型,我有两个项目:Activity 和 Workitem。
搜索名称为“Activity”的图形元素有那么难吗?
提前谢谢你
【问题讨论】:
-
你的名字是什么意思?您是否将其指定为模型的属性属性?
-
是的@SajithDilshan 我有“文本”属性。你能帮我访问活动吗?这是“活动”的模板描述: new joint.shapes.basic.Rect({ size: { width: 5, height: 3 }, attrs: { rect: { rx: 2, ry: 2, width: 50,高度:30,填充:'#0000FF'},文本:{ 文本:'Activity',填充:'#ffffff','font-size':10,描边:'#000000','描边宽度':0 } } }),
标签: search graph jointjs rappid