fix(react) fitViewOptions.nodes are now working as intended
This commit is contained in:
@@ -171,7 +171,7 @@ export function fitView<Params extends FitViewParamsBase<NodeBase>, Options exte
|
||||
options?: Options
|
||||
) {
|
||||
const filteredNodes = nodes.filter((n) => {
|
||||
const isVisible = options?.includeHiddenNodes ? n.width && n.height : !n.hidden;
|
||||
const isVisible = n.width && n.height && (options?.includeHiddenNodes || !n.hidden);
|
||||
|
||||
if (options?.nodes?.length) {
|
||||
return isVisible && options?.nodes.some((optionNode) => optionNode.id === n.id);
|
||||
@@ -180,11 +180,8 @@ export function fitView<Params extends FitViewParamsBase<NodeBase>, Options exte
|
||||
return isVisible;
|
||||
});
|
||||
|
||||
console.log(filteredNodes);
|
||||
|
||||
if (filteredNodes.length > 0) {
|
||||
const bounds = getRectOfNodes(filteredNodes, nodeOrigin);
|
||||
console.log(bounds);
|
||||
|
||||
const [x, y, zoom] = getTransformForBounds(
|
||||
bounds,
|
||||
|
||||
Reference in New Issue
Block a user