From 0ed3078f38506dc19d8579b693d7e3d63afc7d17 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Mon, 26 Oct 2020 18:21:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0delete=E5=88=A0=E9=99=A4node?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/gva-wfd/behavior/deleteItem.js | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/web/src/components/gva-wfd/behavior/deleteItem.js b/web/src/components/gva-wfd/behavior/deleteItem.js index e7f53f01..faac4f83 100644 --- a/web/src/components/gva-wfd/behavior/deleteItem.js +++ b/web/src/components/gva-wfd/behavior/deleteItem.js @@ -1,31 +1,31 @@ /* 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', []); + } + }, + 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); - } - }); -} + }); +} \ No newline at end of file -- GitLab