Merge branch 'gva_workflow' of https://github.com/flipped-aurora/gin-vue-admin into gva_workflow
This commit is contained in:
@@ -1,31 +1,45 @@
|
||||
/* eslint-disable */
|
||||
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]);
|
||||
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 === 46 && 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', []);
|
||||
}
|
||||
if (e.ctrlKey == true && e.keyCode == 90) { //Ctrl+z
|
||||
e.returnvalue = false;
|
||||
if (this.graph.executeCommand) {
|
||||
this.graph.executeCommand('undo', {});
|
||||
}
|
||||
}
|
||||
if (e.ctrlKey == true && e.keyCode == 89) { //Ctrl+y
|
||||
e.returnvalue = false;
|
||||
if (this.graph.executeCommand) {
|
||||
this.graph.executeCommand('redo', {});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
onCanvasLeave(e) {
|
||||
this.graph.set('focusGraphWrapper', false);
|
||||
},
|
||||
onCanvasFocus() {
|
||||
this.graph.set('focusGraphWrapper', true);
|
||||
}
|
||||
this.graph.set('selectedItems',[]);
|
||||
this.graph.emit('afteritemselected',[]);
|
||||
}
|
||||
},
|
||||
onCanvasLeave(e){
|
||||
this.graph.set('focusGraphWrapper',false);
|
||||
},
|
||||
onCanvasFocus(){
|
||||
this.graph.set('focusGraphWrapper',true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user