let r1 = new joint.shapes.standard.Rectangle({
position: { x: 200, y: 300 },
size: { width: 400, height: 200 },
attrs: {
body: { fill: '#d2d2d2', rx: 6, ry: 2, stroke: 'green', strokeWidth: 3 },
label: { text: item.name, refY: 10, fontSize: 18, fontWeight: 'bold', fontVariant: 'small-caps' }
}
});
r1.set('z', 999);
let r2 = new joint.shapes.standard.Rectangle({
position: { x: 400, y: 300 },
size: { width: 300, height: 200 },
attrs: {
body: { fill: '#d2d2d2', rx: 6, ry: 2, stroke: 'green', strokeWidth: 3 },
label: { text: item.name, refY: 10, fontSize: 18, fontWeight: 'bold', fontVariant: 'small-caps' }
}
});
this.graph.addCells([r1, r2]);
我在jointjs中创建了两个矩形,在所附图像中分别命名为1和2 问题是,当我尝试从2移动1时,内容1下降到2 我怎样才能将rect 1移到2上面?
答案 0 :(得分:0)
当我们将矩形1的z索引值设置为 r1.set('z',999); 另一方面,我们还必须为r2设置z index的值 如果我们想看到r1高于r2,则该值应小于r2 当我将r2的z设置为 r2.set('z',100);
解决了我的问题