Skip to content

How to register a Mouse Listener for Double-Click Events? #745

Answered by planger
rsoika asked this question in Q&A
Discussion options

You must be logged in to vote

To register a mouse listener you'll have to add an injectable class that extends MouseListener:

@injectable()
export class YourMouseListener extends MouseListener {
    doubleClick(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
        // TODO your implementation
        // this can return an action or get other services injected and call them on double-click
        return [];
    }
}

You only need to override the methods (mouse events) that you are interested in. The super class MouseListener has empty implementations by default. From such a method you can either return actions, which will be dispatched by the framework, or you can put in arbitrary code, e.g. …

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@rsoika
Comment options

@planger
Comment options

@rsoika
Comment options

@planger
Comment options

@rsoika
Comment options

Answer selected by rsoika
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants