MCPcopy Create free account
hub / github.com/adobe/react-spectrum / isValid

Method isValid

packages/@react-spectrum/ai/src/ListLayout.ts:646–657  ·  view source on GitHub ↗
(node: Node<T>, offset: number)

Source from the content-addressed store, hash-verified

644 }
645
646 protected isValid(node: Node<T>, offset: number): boolean {
647 let cached = this.layoutNodes.get(node.key);
648 let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';
649 return (
650 !this.invalidateEverything &&
651 !!cached &&
652 cached.node === node &&
653 offset === cached.layoutInfo.rect[offsetProperty] &&
654 cached.layoutInfo.rect.intersects(this.validRect) &&
655 cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))
656 );
657 }
658
659 protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {
660 if (this.isValid(node, this.orientation === 'horizontal' ? x : y)) {

Callers 3

buildCollectionMethod · 0.95
buildChildMethod · 0.95
buildSectionMethod · 0.95

Calls 3

intersectsMethod · 0.80
containsRectMethod · 0.80
intersectionMethod · 0.80

Tested by

no test coverage detected