Find all elements/objects within the node

Hi,

I am trying to implement the hover effect for which I want to find the elements in the node whose name matches with some condition and change the stroke of those objects.

I have implemented the hover in context menu, but there is only one element i need to find out which can be done using findObject(). But i need to find all elements.

I searched but could not find anything as such till now, is there a way to get those?

Its not working, I tried basic code

onNodeMouseEnter = function(e, d) {
  var tObject, wrapObjects;
  console.log("Name--", d.name);
  tObject = d;
  console.log("tObject", tObject);
  wrapObjects = scope.diagram.findObjectsIn(tObject, function(o) {
    console.log("Name", o.name);
    return o.name === "messageWrapShape";
  }, function(o) {
    return console.log(o);
  }, true);
  return console.log("wrapObjects", wrapObjects);
};

its not printing the console statement itself in finder functions

First, are you using go-debug.js and checking the console window for any warning messages or error messages?

Second, have you noticed that the first argument to Diagram | GoJS API must be a Rect, not a GraphObject?

Yes got that its expecting Rect, but how do i create Rect object from node/Graph object.

For a Node, you can use its Node.actualBounds, which is always in document coordinates.

For some GraphObject inside a Node (or any Part, really), you’ll need to call GraphObject.getDocumentPoint on various spots of the GraphObject and then build the Rect that you want. I can’t tell you what to do because I don’t know what you want, and besides the object might not be rectangular and might be scaled and/or rotated.