almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Selection box #4242

Open softwareCobbler opened 5 years ago

softwareCobbler commented 5 years ago

This implements a "selectionBox" feature in Network's interaction module. With this option enabled, the user can press CTRL and left click and then drag a box around the canvas. Let go and it selects the nodes and/or edges within the box (there are option flags the user can set to have it select nodes / edges).
Open to feedback!
This was briefly discussed in #4233.
Thanks! sbox

softwareCobbler commented 5 years ago

Quick video example of feature

jgorene commented 5 years ago

A priori, I didn't encounter any bugs at least after a few tests. Subject to further testing, this seems ready to be implemented at the latest on v4.22. Good work !

softwareCobbler commented 5 years ago

considering the line width option - since CanvasRenderingContext2D.lineWidth is in coordinate space, I'm not certain how to provide a sane default. The value the user provides will change in apparent thickness as the zoom scale changes. Recalculating upon camera scale changes is the obvious solution, but I don't know quite what units the user expects to see.
Should a value of 1.0 always be 1 screen pixel? Or 1% of the total canvas area?

jgorene commented 5 years ago

@softwareCobbler Indeed and it's already very good like that, no problem :relieved: I still have a lot to learn and it will take me a little more time to properly analyze the new option , anyway.

@mojoaxel Just by the way and nothing to do with this new interaction option but it seems that "zoomSpeed" option is obsolete... but maybe I missed something?

softwareCobbler commented 5 years ago

Got the lineWidth option up and running for this:

mojoaxel commented 5 years ago

@softwareCobbler Please consider moving this pull-request over to vis-network! Also we are always looking for people that might be interesting in helping maintaining :wink:

softwareCobbler commented 5 years ago

Haha thought it was DOA--when I can scrape together some time I'd be happy to.

Thanks, Dave R.

On Tue, Jul 23, 2019, 7:41 AM Alexander Wunschik notifications@github.com wrote:

@softwareCobbler https://github.com/softwareCobbler Please consider moving this pull-request over to vis-network https://github.com/visjs/vis-network! Also we are always looking for people that might be interesting in helping maintaining 😉

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/almende/vis/pull/4242?email_source=notifications&email_token=AEPAW2ACVLDDXO4ZWMQM46LQA34BNA5CNFSM4GT7NWR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2S7LHI#issuecomment-514192797, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPAW2FQFAAAHQD6V3UXROLQA34BNANCNFSM4GT7NWRQ .