`findPartAt` wrong query result

I move the node within the group, and call findPartAt to pass in the node position at the end of the move, but when the node moves to the group boundary, the returned result is not accurate.
My group uses a custom graph DividedProcess
graphic link

When the node moves to this position, findPartAt can still find that the parent level is group

How are you determining the Point to pass to the call to Diagram.findPartAt?

When I finish dragging the node, I pass in the position of the node.

The following is a screenshot of my test example, when the node is moved out of the group, calling findPartAt still finds the group

I cannot tell from your screenshot what the value of insideGroup is.
I would expect that insideGroup === focusNode.
Is that not the case?

In other words, calling Diagram.findPartAt at a point where a node is and no other nodes or links are, should be expected to return that node.

thanks reply

Well, there is something wrong with my understanding of findPartAt.
So why is the node’s group not removed when the node is moved to the junction of the group border, or moved out of the group.

Or is there any way to judge that this kind of node is dragged out of the group or dragged to the junction of the group border

I do not understand what you are trying to ask. Could you please illustrate a situation and present some code and what the results are?

In short, I want to know whether it is dragged out of the group at the end of the node dragging (assuming that the node is initially located in the group)

Isn’t it sufficient to see if their bounds intersect?
node.actualBounds.intersectsRect(group.actualBounds)
Or:
node.actualBounds.intersectsRect(group.resizeObject.getDocumentBounds())

Thank you. I’ll try it tomorrow.

Since my group is custom, I don’t want the top area to also count as the content of the group

So when I move the node up, the calculation of intersectsRect is wrong. I tried using inflate to reduce the height of the group, but the calculation result of intersectsRect still does not change.

Is there any other way please?

You need to get the bounds of the group’s area that you care about in document coordinates.

In my code above, and in my earlier referenced sample, that is Part.resizeObject. Hence:
node.actualBounds.intersectsRect(group.resizeObject.getDocumentBounds())

Substitute resizeObject with whatever works for your group template. Maybe something like findObject("...").

Thank reply

But my group is a whole, not pieced together by two graphics, I can’t get the boundary of that part of the area through findObject

OK, then you can compute the Rect however you like.

Note that many of the GraphObject properties are immutable Rects or Sizes or Points. Call copy on them before you modify any of their properties.

If you use the go-debug.js library file instdad of go.js, it will automatically catch a lot of those kinds of errors.