dracula icon indicating copy to clipboard operation
dracula copied to clipboard

option to disable node dragging

Open bagnus opened this issue 7 years ago • 3 comments

I need a way to disable dragging on some nodes.

Case test: graph.addNode('Banana', { nodrag:true }); I changed the original code at bottom of drawNode():

node.shape.connections = [];
dragify(node.shape);

resulting in:

node.shape.connections = [];
if(!node.nodrag) {dragify(node.shape);}

Is there a better way to do it ?

Regards Andrea

bagnus avatar Mar 03 '17 10:03 bagnus

It would be best to specify custom drag handlers, passing undefined for no drag or default. So there are three options: default drag, no drag, custom drag. imo this is most desirable for customizability. How to make the interface for this, I'm not sure. Maybe still keep the 'nodrag' option...

monomon avatar Nov 05 '17 11:11 monomon

On a second thought, preventing the default drag and then manually hooking a custom one would be fine, too.

monomon avatar Nov 05 '17 14:11 monomon

I have created a pull request https://github.com/strathausen/dracula/pull/47 for this. The switch is named noDefaultDrag.

monomon avatar Nov 16 '17 10:11 monomon