Input event client coordinate

Is there any way to get mouseEvent clientX and clientY when gojs emit backgroundContextClicked Event?

We tried diagram.lastInput.viewPoint and documentPoint and didn’t work.


What do you mean that diagram.lastInput.viewPoint and .documentPoint didn’t work? The “BackgroundContextClicked” DiagramEvent cannot be raised unless the Diagram.lastInput is at a point that is considered to be “in the background of the diagram”.

sorry for the confusion. We can get diagram.lastInput.viewPoint and diagram.lastInput.documentPoint.

However, they are not same as mouseEvent clientX and clientY in our application.

The question is that how to get clientX and clientY in backgroundContextClicked event.


Strictly speaking that is only available on the DOM Event, which you can get from the InputEvent.event.

However there may be other ways of calculating the clientX and clientY.

@walter Thanks a lot! It works.