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
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
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())
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.
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("...").