public filterNodes()

in packages/network-navigator/src/NetworkNavigator.ts [633:653]


    public filterNodes(text: string, animate = true) {
        let temp: d3.Selection<any>|d3.Transition<any> = this.vis.selectAll(".node circle");
        if (animate) {
            temp = temp
                .transition()
                .duration(500)
                .delay(100);
        }
        const pretty = (val: string) => ((val || "") + "");
        temp.attr("transform", (d: any) => {
            // If the node matches the search string, then scale it
            let scale = 1;
            const searchStr = d.name || "";
            const flags = this.configuration.caseInsensitive ? "i" : "";
            const regex = new RegExp(escapeRegExp(text), flags);
            if (text && regex.test(pretty(searchStr))) {
                scale = 3;
            }
            return `scale(${scale})`;
        });
    }