Finding textblock position

I am trying to test my code with go js diagram
I need to simulate mouse click on a textblock

the problem I have is how to find the textblock position.x and position.y

I Have a node that contains several textblocks
I need to find a specific textblock in order to programmatically click on it.

thanks

If there are a fixed number of TextBlocks in the node, perhaps it would be easiest if you assigned a name to each one that you might need to find at runtime. Then you can call Panel.findObject on the Node with the desired name string.

If there are a variable number of TextBlocks, you will first need to find the specific Panel that contains the TextBlock that you care about. There are several Panel methods that might be used to find the desired panel.

If it returns a TextBlock, as it should if the name is unique, then you can call GraphObject.findDocumentPoint on it to get the document coordinates for some spot in that textblock. (go.Spot.Center is commonly used.)

You can then call Diagram.transformDocToView to change the Point into viewport coordinates. I suppose then you’ll want to convert viewport coordinates (i.e. x,y within the diagram’s HTML DIV element) into screen coordinates.

https://gojs.net/latest/intro/viewport.html

thanks,
I have reference to the textblock I have a unique name for it.
the text block is inside a panel, so simulate clicking on the panel is also good for me.

I was looking for findDocumentPoint but could not find it.

please advice.

Sorry, that was a typo. I meant GraphObject | GoJS API