From aecc51f16c9d0b6738df4aa063fdfa40c469ff8e Mon Sep 17 00:00:00 2001 From: Vitaliy Stoliarov Date: Sat, 27 Oct 2018 18:50:39 +0300 Subject: [PATCH] v1.0.0-beta.2, add event --- package.json | 2 +- src/events.js | 1 + src/view/node.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fe8c04f0..7ba9d462 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rete", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "description": "JavaScript framework", "main": "build/rete.min.js", "types": "src/index.d.ts", diff --git a/src/events.js b/src/events.js index 89f2d279..567ad323 100644 --- a/src/events.js +++ b/src/events.js @@ -15,6 +15,7 @@ export class EditorEvents extends Events { translatenode: [], nodetranslate: [], nodetranslated: [], + nodedraged: [], selectnode: [], nodeselect: [], nodeselected: [], diff --git a/src/view/node.js b/src/view/node.js index 912b14ba..333a7073 100644 --- a/src/view/node.js +++ b/src/view/node.js @@ -20,7 +20,9 @@ export class Node extends Emitter { this.el.addEventListener('contextmenu', e => this.trigger('contextmenu', { e, node: this.node })); this._startPosition = null; - this._drag = new Drag(this.el, this.onTranslate.bind(this), this.onSelect.bind(this)); + this._drag = new Drag(this.el, this.onTranslate.bind(this), this.onSelect.bind(this), () => { + this.trigger('nodedraged', node); + }); this.trigger('rendernode', { el: this.el,