工作流插件参与进入项目本体

This commit is contained in:
QM303176530
2020-10-24 17:04:04 +08:00
parent cebb9b3002
commit 84e35753cf
97 changed files with 6198 additions and 14 deletions
@@ -0,0 +1,30 @@
export default function(G6){
G6.registerBehavior('deleteItem', {
getEvents() {
return {
'keydown': 'onKeydown',
'canvas:mouseleave': 'onCanvasLeave',
'canvas:mouseenter': 'onCanvasFocus',
}
},
onKeydown(e){
const items = this.graph.get('selectedItems');
const focus = this.graph.get('focusGraphWrapper');
if(e.keyCode === 8 && items && items.length > 0 && focus){
if(this.graph.executeCommand) {
this.graph.executeCommand('delete', {});
}else{
this.graph.remove(items[0]);
}
this.graph.set('selectedItems',[]);
this.graph.emit('afteritemselected',[]);
}
},
onCanvasLeave(e){
this.graph.set('focusGraphWrapper',false);
},
onCanvasFocus(){
this.graph.set('focusGraphWrapper',true);
}
});
}