joint.js提供元素高亮显示,只需要如下代码就可以实现:
paper.on('cell:pointerclick', function(cellView) {
cellView.highlight();
});
默认效果如下:
为了美观,我们想要修改highlight的样式:
语法:cellView.highlight([el[, options]])
el
如果不指定则为cellView.el
cellView.highlight(null,{
highlighter:{
name:'stroke',
options:{
padding: 10,
rx: 5,
ry: 5,
attrs:{
'stroke-width': 3,
stroke:'#F56C6C'
}
}
}
});
除了stroke,还可以选择添加class:
cellView.highlight(null/* defaults to cellView.el */, {
highlighter: {
name: 'addClass',
options: {
className: 'some-custom-class'
}
}
});