besley
June 16, 2022, 11:29am
1
I want to capture/listen the element click event, I found this program CommandInterceptor can make it. There is some reason not working at all, only the shape.create event is workong properly.
The project on the codesandbox is here:
CommandInterceptor on CodeSandBox
Could someone make any suggestions here. I must miss something else. Thanks
Martin
June 16, 2022, 12:51pm
2
For click events, you don’t need the CommandInterceptor. Those are only relevant when the state changes, such as adding/removing shapes.
If you just want to listen for element clicks, you can simply use the eventBus:
function MyExtension(eventBus) {
eventBus.on("element.click", (e) => console.log(e.element));
}
MyExtension.$inject = ["eventBus"];
export default {
__init__: ["myExtension"],
myExtension: ["type", MyExtension]
};
besley
June 22, 2022, 7:01am
3
@Martin , Thanks your answer, it’s very clear.
system
Closed
June 29, 2022, 7:02am
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.