fix(onlyRenderVisible) render nodes with fixed width & height intially
This commit is contained in:
@@ -191,21 +191,22 @@ export const getNodesInside = <NodeType extends NodeBase = NodeBase>(
|
|||||||
|
|
||||||
const visibleNodes: InternalNodeBase<NodeType>[] = [];
|
const visibleNodes: InternalNodeBase<NodeType>[] = [];
|
||||||
|
|
||||||
for (const [, node] of nodes) {
|
for (const node of nodes.values()) {
|
||||||
const { measured, selectable = true, hidden = false } = node;
|
const { measured, selectable = true, hidden = false } = node;
|
||||||
const width = measured.width ?? node.width ?? node.initialWidth ?? null;
|
|
||||||
const height = measured.height ?? node.height ?? node.initialHeight ?? null;
|
|
||||||
|
|
||||||
if ((excludeNonSelectableNodes && !selectable) || hidden) {
|
if ((excludeNonSelectableNodes && !selectable) || hidden) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const width = measured.width ?? node.width ?? node.initialWidth ?? null;
|
||||||
|
const height = measured.height ?? node.height ?? node.initialHeight ?? null;
|
||||||
|
|
||||||
const overlappingArea = getOverlappingArea(paneRect, nodeToRect(node));
|
const overlappingArea = getOverlappingArea(paneRect, nodeToRect(node));
|
||||||
const notInitialized = width === null || height === null;
|
const area = (width ?? 0) * (height ?? 0);
|
||||||
|
|
||||||
const partiallyVisible = partially && overlappingArea > 0;
|
const partiallyVisible = partially && overlappingArea > 0;
|
||||||
const area = (width ?? 0) * (height ?? 0);
|
const forceInitialRender = !node.internals.handleBounds;
|
||||||
const isVisible = notInitialized || partiallyVisible || overlappingArea >= area;
|
const isVisible = forceInitialRender || partiallyVisible || overlappingArea >= area;
|
||||||
|
|
||||||
if (isVisible || node.dragging) {
|
if (isVisible || node.dragging) {
|
||||||
visibleNodes.push(node);
|
visibleNodes.push(node);
|
||||||
|
|||||||
Reference in New Issue
Block a user