Just find the square

`

I want to keep the writing and the frame separate. For this I just need to find the frame and draw the guide lines accordingly. But here’s how I do it with the square and the writing. I used a code like this, but it did not work.

this.diagram.findObjectsIn(part.actualBounds, function (x) { if (x._isGuideObject) { square = x.part; } }, function (link) { }, true );

Are you trying to get the GuidedDraggingTool to ignore the TextBlock(s) that are outside of the Part.selectionObject?

If I get a chance later today I’ll work on this for you.

OK, to the GuidedDraggingTool.js file, add this helper function:

function getDocBounds(obj) {
  if (obj instanceof go.Part) obj = obj.selectionObject;
  return new go.Rect(obj.getDocumentPoint(go.Spot.TopLeft),
                     obj.getDocumentPoint(go.Spot.BottomRight));
}

This assumes that you have set Node.selectionObjectName to refer to the element whose sides you want nodes to align with.

[BTW, in the next non-bug-fix release we’re adding a GraphObject.getDocumentBounds method that is better and faster than this function.]

Then replace all of the expressions:

    x.actualBounds

with:

    getDocBounds(x)