Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
is it possible ?
Hi!
I want to make an image wich fires mouse clicks events. When image clicked I want to send X and Y mouse coordinates to vaadin component. How to make this ?
Thanks for answers in advance
You could also wrap the image in a layout and add a mouse click listener to the layout.
John Ahlroos: You could also wrap the image in a layout and add a mouse click listener to the layout.
No need to wrap it in a layout as you can add a ClickListener directly to an Embedded. The problem however is that you only get coordinates relative to the screen and not relative to the component (#4652).
get coordinates relative to the screen
Artur,
is there a way to convert them into local coordinates ?
Dima A Ry:
get coordinates relative to the screen
Artur,
is there a way to convert them into local coordinates ?
You would have to do that on client side, in practice by fixing #4652. Extending com.vaadin.terminal.gwt.client.MouseEventDetails (NativeEvent evt) constructor, figuring out the needed coordinates, adding them to serialize/deserialize and add a getter should be all that is needed. If you want to contribute, please add a patch to the aforementioned ticket.