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

Method isValid

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

Source from the content-addressed store, hash-verified

668 }
669
670 protected isValid(node: Node<T>, offset: number): boolean {
671 let cached = this.layoutNodes.get(node.key);
672 let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';
673 return (
674 !this.invalidateEverything &&
675 !!cached &&
676 cached.node === node &&
677 offset === cached.layoutInfo.rect[offsetProperty] &&
678 cached.layoutInfo.rect.intersects(this.validRect) &&
679 cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))
680 );
681 }
682
683 protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {
684 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