We have implemented some custom logic for draggingTool.doActivate and doDeactivate, which are passed as DiagramInitOptions to enable drag and drop functionality. Now, we want to use the NonRealtimeDraggingTool extension (NonRealtimeDraggingTool | GoJS API). However, when we do this, the doActivate method from DiagramOptions seems to be overridden.
Is this the expected behavior?
How can we combine our custom dragging logic with the NonRealtimeDraggingTool?
Should we merge the extension code with our custom implementation?
Hi @walter ,
Please let us know if this is how it works:
class CustomDraggingTool extends NonRealtimeDraggingTool {
doActivate() {
// some custom logic;
super.doActivate() //Does this call the doActivate of the NonRealtimeDraggingTool?
}
doDeactivate() {
// some custom logic;
super.doDeactivate() //Does this call the doDeactivate of the NonRealtimeDraggingTool?
}
}
And use the CustomDraggingTool here
new Diagram(. . ., {
. . .,
draggingTool: new CustomDraggingTool()
})
Yes, that should work, but I assume the reason you want to override those methods is because you want to do some additional work before and after the regular behavior of the tool. I don’t know what that is, so I cannot say exactly what code you want to add there.