Thanks a lot Walter.The problem has solved and is working fine.
But i have a new issue now : resizing.
I have used this Simple Group Resizing.
Facing two problem.
When trying to resizing any other Nodes except group,error is coming.
When resizing Group,same problem as previous, Node is going out of Shape.
“resizingTool.computeMinSize”: function() {
var group = this.adornedObject.part;
var shape = group.resizeObject;
var membnds = group.diagram.computePartsBounds(group.memberParts);
membnds.addMargin(GroupMargin);
membnds.unionPoint(group.location);
return membnds.size;
}
Here the resizing is for group only.So when i am resizing any node ,getting error in the below line.
var membnds = group.diagram.computePartsBounds(group.memberParts);
OK, so if you debug it, what is undefined? And why?
I have tried that ResizingTool.computeMinSize override, and it works well for me. But I do notice now that the var shape = group.resizeObject; is superfluous and can be deleted.
Have you tried for single node? For group it is working but for single node it is giving error.
Because in group.diagram.computePartsBounds(group.memberParts) -
computePartsBounds takes collection and for single node collection i.e. group.memberParts
is undefiend.
Yes.So i am trying like this.
“resizingTool.computeMinSize”: function() {
var group = this.adornedObject.part;
if(group instanceof go.Group){
var membnds = group.diagram.computePartsBounds(group.memberParts);
membnds.addMargin(GroupMargin);
membnds.unionPoint(group.location);
return membnds.size;
}
else{
}
},
But what should i return in else condition??(for single node)
No.I am asking if i have any node except group i.e.
When resizing it,then actually no need of resizingTool.computeMinSize.Then what should i do.
Or if it use resizingTool.computeMinSize, the which size i should return?
here i created polygon boundary, outside object(Top Right Corner Rectangle) also added as member of the Boundary.for that i wrote logic like
var objectInsideShape = diagram.findObjectsIn(part.actualBounds,
function (x: any) {
var part = x.part;
var d = part.data;
if ((part instanceof go.Link || part instanceof go.Node) && !(part instanceof go.Group) ) {
return part;
}
return null;
},
null, false);
so. how can i avoid outside member as not part of the polygon boundary?
I need only objects inside boundary. i found so many gojs methods findObjectAt ,findObjectsAt, findObjectsIn ,findPartAt. but except findObjectsIn, all other methods need particular node. i need all the objects inside boundary. which method i can use to solve this problem?
Regarding @Santanu044 Question I have the Same issue, While moving the Polygon Boundary it will take the all the inside and Outside Object also ,Its taking all Object like in Rectangle shape like a behavior of Group not in Boundary, Could you tell me where i need to change the Method belong to this issue. For the Reference i added attachment snaps for you.
Hi Walter,i have a one polygon boundary as above and it contains the objects which are inside the polygon boundary,there is one more object outside the polygon boundary,the problem is when i select polygon boundary and then move i want only
whatever inside polygon boundary objects along with polygon boundary object ,but out side object are also moving.By default its taking rectangler boundary ,could you please provide any solution.Thank You
If you make the Polygon Boundary a Group object, and you add the objects inside of it as member nodes, moving the Polygon will automatically move the Nodes inside. This functionality is built into the group class.
You would want your group to not have a Placeholder.
There is no built in way to “find all objects within a polygon area” in GoJS. You could write such a method yourself, but it may take some experimentation.