0
我能够正确检索除swimlane pool以外的所有形状。我试着用jointjs 0.9.5和0.9.3。他们都抛出类似的错误:从jointjs的数据库中检索形状时出错
Uncaught Error: dia.ElementView: reference does not exists
@ joint_0.9.5.js:5286
joint.dia.ElementView.joint.dia.CellView.extend.positionRelative
@ joint_0.9.5.js:5286
使用jointjs 0.9.3在此行给出了错误
遗漏的类型错误:未定义
if (ref) {
// Get the bounding box of the reference element relative to the root `<g>` element.
bbox = V(this.findBySelector(ref)[0]).bbox(false, this.el);
}
无法读取属性“BBOX”我的形状被定义像这样:
joint.shapes.devs.Container = joint.shapes.devs.Model.extend(_.extend({}, joint.plugins.TooledModelInterface, {
markup:
[
'<g class="rotatable">',
'<g class="scalable">',
'<rect class="body"/>',
'</g>',
'<rect class="pool_header"/>',
'<text class="t"/>',
'<g class="inPorts"/>',
'<g class="outPorts"/>',
'<g class="moveTool"/>',
'<g class="resizeTool"/>',
'<g class="portsTool"/>',
'</g>'
].join(''),
defaults: joint.util.deepSupplement({
type: 'devs.TooledModel',
position: {x: 200, y: 100},
size: {width: 71, height: 625},
attrs:
{
'.body': {fill: '#ffffff', stroke: '#000000', width: 500, height: 200, 'pointer-events': 'stroke'},
'.pool_header': {fill: '#fff', stroke: '#000', width: 30, ref: '.body', 'ref-height': 1, 'pointer-events': 'visiblePainted'},
'.t': {transform: 'rotate(-90)', ref: '.pool_header', dx: '-0.1%', dy: '50%', 'x-alignment': 'middle', 'text-anchor': 'middle'},
rect: {stroke: '#000000', fill: '#EEEEEE', 'stroke-width': 2}, '.': {magnet: false},
'.inPorts circle': {type: 'input'},
'.outPorts circle': {type: 'output'},
'.port-body': {r: 3}
}
}, joint.shapes.devs.Model.prototype.defaults)
}
更新:
我检查了很多次。
console.log(V(this.findBySelector(ref)[0]).bbox(false, this.el));
我手动检查它,这里是错误:只有whlie从数据库中检索,jointjs是不是能够得到以下的边框会出现此问题。由于此错误,池标题不显示,并且形状本身看起来扭曲