-
Notifications
You must be signed in to change notification settings - Fork 23
How to implement onclick event on any node or edge? #240
Comments
Usually, you have to create a mouse listener, implement the method for the event and then bind it as TYPES.IMouseListener in your di.config.ts. The actual consequence of the click usually is an action. If the SModel should be changed, create and register a command handling the action. |
Could please provide an example for the same? |
Could you be more specific about what you're trying to achieve? |
I need to show a modal/popup while clicking on an edge. |
I'd try to add an action handler for export class MyActionHandler implements IActionHandler {
handleAction(Action a) {
if(a instanceof SelectAction) {
// investigate if a single edge is selected and in this case open the dialog
}
}
}
export MyActionHandlerInitializer implements IActionHandlerInitializer {
initialize(registry: ActionHandlerRegistry) {
registry.register(SelectAction.KIND, new MyActionHandler())
}
} In your di.config.ts bind(TYPES.IActionHandlerInitializer).to(MyActionHandlerIntializer) |
OK, Thanks. |
If you need to access the model as well, then I'd rather bind a custom model source, have a look at |
Ok |
No description provided.
The text was updated successfully, but these errors were encountered: