-
Notifications
You must be signed in to change notification settings - Fork 6
Adding Diagram Interaction
The is a Sprotty module that adds diagram interaction in klighd-vscode: the interactiveModule.
The interactiveModule is here bound to the container, which in turn is create here. Sprotty also supports using a key listener, a context menu, and a mouse listener.
To understand what we need to do to add interactive functionality to the diagram, we will however limit us to the interactiveModule implementation.
The diagram container usually communicates with the outside (i.e. the rest of the VS Code extension or the language server) via Sprotty actions such as the interactive rectpacking actions, which are registered in the diagram server. Currently, this can only be done inside klighd-vscode or by extending the registration class. In the future this should also be possible by using a service interface to let other extentions add actions and contribute to the view.
These actions are forwarded to the server if they are not handled on the client in the handle method of the diagram server or handled by Sprotty on the client in the super implementation of handle.
A short guide how the server part of adding diagram interaction could look like can be found here.