Problem: When I hover over this shape using mouseHover, how do I retrieve the center coordinate of the shape relative to the document (the x), ie. (5,5)?
Currently, if I perform getDocumentPoint(go.Spot.Center) on the Shape it returns me the coordinates of the center relative to the shape, (2,2). But I am looking for the coordinates relative to the entire diagram.
e.viewPoint only returns the center coordinates relative to the entire diagram.
Is your 6x6 diagram talking about the Diagram.documentBounds or the Diagram.viewportBounds?
Note that almost everything in GoJS is in document units, which are unaffected by scrolling/panning/zooming. The position and size of Parts are in document coordinates. The very few places where one encounters viewport coordinates are clearly documented. GoJS Coordinate Systems-- Northwoods Software
Certainly GraphObject.getDocumentPoint returns a point in document coordinates. That point is in the same coordinate system as Diagram.documentBounds.
It was a more a generic question… if I had a shape somewhere on the diagram, how do I get the exact center of that shape? Whenever I do node.getDocumentPoint(go.Spot.Center) it does indeed return me the center (x,y) of the shape, but not relative to the canvas, just relative to itself, if that makes sense.