Getting part at double click point

We’ve had this code which works for double-clicks until the canvas is big enough to use scrollbars. Once scrollbars appear part is either null or the wrong part.

var me = this,
record = me.getViewModel().get(‘record’),
point = e.diagram.lastInput.viewPoint,
part = e.diagram.findPartAt(point, false);

I changed it to this and it seems to work but I want to make sure I’m not doing something wrong.

var me = this,
record = me.getViewModel().get(‘record’),
point = e.diagram.lastInput.documentPoint,
part = e.diagram.findPartAt(point, false);

I changed lastInput.viewPoint to lastInput.documentPoint. Let me know if this is correct or if there is a better way to get the part on the double click event.

That’s right. As documented at http://gojs.net/latest/api/symbols/Diagram.html#findPartAt, et al., all of the “find…” methods take document coordinates, not view coordinates.