Javascript jointjs:svg文本在放到纸上时替换为空白
在模具中我们有png,在纸上我们用svg替换单元格[png] 单元格-表示png 矢量字符串-png的标记Javascript jointjs:svg文本在放到纸上时替换为空白,javascript,svg,backbone.js,jointjs,Javascript,Svg,Backbone.js,Jointjs,在模具中我们有png,在纸上我们用svg替换单元格[png] 单元格-表示png 矢量字符串-png的标记 var currentSvg = new joint.shapes.basic.pwmeter({ position: { x: bbox.x, y: bbox.y }, size: { height: cell.attributes.minHeight, width: cell.attributes.minWidth },
var currentSvg = new joint.shapes.basic.pwmeter({
position: { x: bbox.x, y: bbox.y },
size: { height: cell.attributes.minHeight, width: cell.attributes.minWidth },
minWidth: cell.attributes.minWidth,
minHeight: cell.attributes.minHeight,
markup: vectorString,
type: cell.attributes.type,
fileName: cell.attributes.fileName,
isInteractive: true,
elementClassName: cell.attributes.elementClassName,
isAnimatedDevice: cell.attributes.isAnimatedDevice,
attrs: {
'.myClass': {
fill: '#ffffff',
stroke: '#000000'
}
}
});
currentSvg.addTo(Rappid.graph);
我们正在通过扩展图像来制作pwmeter joint.shapes.basic.pwmeter=joint.shapes.basic.Image.extend({ 类型:“basic.pwmeter”, 初始化:函数(){ 返回joint.shapes.basic.Image.prototype.initialize.apply(这是参数); } }); 我们将png从模板放到纸上,得到对应png的svg标记, 我们调用currentSvg.addTo(Rappid.graph),在执行过程中,meter[svg]中的所有文本都被替换为空白 我们的文本-0 自动生成的代码替换了我的文本,我们无法理解为什么会发生这种情况 - 上面是生成的文本
我们是jointjs新手,我们认为我们在扩展过程中做错了什么。我可以看到您的设置中有一个
标记。确保标记中有文本“占位符”
在本例中,attrtext
与
元素绑定
new joint.shapes.basic.pwmeter({
markup: '<g><image/><text/></g>',
attrs: {
text: { text: '48x48' },
image: { 'xlink:href': 'http://placehold.it/48x48', width: 48, height: 48 }
},
size: { width : 50, height: 50 },
position: { x:200, y: 50},
}).addTo(graph)
有关attr
属性的更多信息可在此处找到我可以看到您的设置中有一个标记
。确保标记中有文本“占位符”
在本例中,attrtext
与
元素绑定
new joint.shapes.basic.pwmeter({
markup: '<g><image/><text/></g>',
attrs: {
text: { text: '48x48' },
image: { 'xlink:href': 'http://placehold.it/48x48', width: 48, height: 48 }
},
size: { width : 50, height: 50 },
position: { x:200, y: 50},
}).addTo(graph)
有关attr
属性的更多信息可在此处找到