GuidedDraggingTool how it will work for group template

Hi ,
I have a group template node so, when I will drop another node and check helpline , so it it is showing according to the group node , but how it will work for the exact node inside the group
so, basically in the pic we have group template having label as node and the geometry string but guided dragging tool is working only the entire group node but i want to check only geometry how I can achieve
image

You will need to modify the GuidedDraggingTool to only consider the nodes you care about given the node being dragged.

you mean we need to modify the guideddraggingtool library file

Maybe not if you override:
https://gojs.net/latest/api/symbols/GuidedDraggingTool.html#isGuiding

yes ,
I have gone through library , we have
public showVerticalMatches(part: go.Part, guideline: boolean, snap: boolean): void {

}
in the parameter we passing go.Part that’s correct but it should work for node as well but , why it is not working for individual node in the group.
see while I am comparing the enter node group helpline are enabling but when I am selecting one node from the grouping in that case helpline are working another node in the same group but it is not checking for other node group template.

can you give some hint or do we have any example like this.

Note how showVerticalMatches calls isGuiding to decide whether to consider the node. That is why I suggested overriding isGuiding to return true only if it’s a node that you want to line up with.

Hi walter,
so, we have this function here we need to return true false based on our requirement correct
protected isGuiding(part: go.Part, guidedpart: go.Part): boolean {

}

That is correct.

Hi Walter,
is there any way when I will drag the node from the html palette the node should be align to the grid from the left hand side of the grid and doesn’t matter how big node it should start from the left handside of the grid position…
I mean align the node from left to right hand side.

Could you please illustrate what you want and what you don’t want?

let suppose if I have multiple node with different size so that , when I will drop the node , the node should align left hand side to right hand side. it means node position start with left hand side to the right hand side… the node can vertical as well horizontal also. my motive is ,while I will connect the node( port) link , the link should be straight automatically we don’t need to do anything.

Your description is still ambiguous – please show 2 sketches or screenshots showing how it will look during a drag and then after a drop.

What is your group template? What is your model data?

That’s very hard to read. Could you please format your code? Surround your code with lines consisting of only triple backquotes.

What do you see when you look at your post?

Put a line consisting only of three backquotes before your code, and another line of triple backquotes after your code.

Hi Walter,

If you will see this picture the node it is taking three cells but actually It should take only 2 cells how we can calculate the size of the node and fit according to the cells exactly
image

I thought the user was dragging and positioning the parts manually.

If you want to control the positioning programmatically, then the responsibility is normally with the Group.layout. You may need a custom layout for that.

ok walter ,

is there any way after dropping the node from the palette node position start from grid left hand side cell to towards right hand
or else can we calculate the location in such a way?

Hi Walter,
this is how I am making align node in the center while drag node from the palette and it is working fine
could you tell me how to calculate the location if I will make it node gridSnapCellSpot=go.spot.left

point.snapToGrid(org.x + sz.width / 2, org.y + sz.height / 2, sz.width, sz.height);

What is your group template?