Question

I want to define a global search in my program. My program has many nodes in a scene and there are a lot of common things on different nodes that could be searched. I think of defining a class searchable and a method for searching in each node.

So when I search by a class selector I would be able to reach all the nodes to highlight them for the user.

For example if Scene or Node has a method like this:

scene.getBySelector(".searchable").filter( (p)-> (Searchable)p.search()).forEach((p) -> (Searchable)p.setHighlited());

It is certainly can be done by iterating a scene or node children recursively but it looks to me so heavy so I'd like to know if there exists such a thig:

CSSUtils.getBySelector(".searchable").filter((p) -> p.getScene() == myScene)...
Was it helpful?

Solution

Node has methods lookup(...) and lookupAll(...) which I think are what you are looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top