Skip to content

Commit

Permalink
add multiselectnode event, v1.4.1-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni55aN committed Jul 13, 2019
1 parent c137e85 commit 6a76e81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rete",
"version": "1.4.0",
"version": "1.4.1-rc.1",
"description": "JavaScript framework",
"main": "build/rete.common.js",
"module": "build/rete.esm.js",
Expand Down
6 changes: 6 additions & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class EditorEvents extends Events {
nodetranslated: [],
nodedraged: [],
selectnode: [],
multiselectnode: [],
nodeselect: [],
nodeselected: [],
rendernode: [],
Expand Down Expand Up @@ -68,6 +69,11 @@ export interface EventsTypes extends DefaultEventsTypes {
node: Node;
accumulate: boolean;
};
multiselectnode: {
node: Node;
accumulate: boolean;
e: MouseEvent;
};
nodeselect: Node;
nodeselected: Node;
rendernode: {
Expand Down
7 changes: 5 additions & 2 deletions src/view/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ export class NodeView extends Emitter<EventsTypes> {
return socket.getPosition(this.node);
}

onSelect(e: MouseEvent) {
onSelect(e: MouseEvent) {
const payload = { node: this.node, accumulate: e.ctrlKey, e };

this.onStart();
this.trigger('selectnode', { node: this.node, accumulate: e.ctrlKey });
this.trigger('multiselectnode', payload);
this.trigger('selectnode', payload);
}

onStart() {
Expand Down

0 comments on commit 6a76e81

Please sign in to comment.