retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10.17k stars 653 forks source link

Multi node selection/dragging key binding #343

Closed renjfk closed 5 years ago

renjfk commented 5 years ago

You think it would be possible to make multi select/dragging key binding platform dependent (changing it to command rather than control on MacOS for example as control + click serves as right click purpose) or customizable somehow?

Ni55aN commented 5 years ago

v1.4.1-rc.1

editor.on('multiselectnode', args => {
     // args.e - MouseEvent
    args.accumulate = args.e.button === 1; // for middle mouse button
    // orТ
    args.accumulate = someKeyPressed;
});

In this way you can define your behavior to accumulate a selected nodes.

renjfk commented 5 years ago

Cool, works perfectly fine. Thanks. Here's snippet who wants to make it cross platform:

editor.on("multiselectnode", (args) => args.accumulate = args.e.ctrlKey || args.e.metaKey);