I am trying to get to the point where I can click on a node and transform the node’s position into doc coordinates via transformViewToDoc
but not having much luck. I added a listener for ObjectSingleClicked
and inside that listener just dumped out e.subject
. However, the position property is reporting NaN
for the view coordinates. Is this normal? Perhaps I need to query some other property, just not sure at this point what to do. Any ideas? Thanks!
Almost all coordinates involving Parts, including all Nodes and Links, are document coordinates.
So in an ObjectSingleClicked
listener, you can get the Diagram.lastInput and look at its properties:
function(e) {
console.log(e.diagram.lastInput.documentPoint)
}
Thanks - that makes much more sense now!