Feat(nodes): add initialWidth and initialHeight (#3953)

* feat(react/svelte): add initialWidth/initialHeight closes #3793

* chore(packages): update changelogs
This commit is contained in:
Moritz Klack
2024-02-27 15:21:35 +01:00
committed by GitHub
parent 14516ab061
commit e5c667d068
28 changed files with 362 additions and 60 deletions
+4 -1
View File
@@ -43,7 +43,9 @@ const getInitialState = ({
let transform: Transform = [0, 0, 1];
if (fitView && width && height) {
const nodesWithDimensions = nextNodes.filter((node) => node.width && node.height);
const nodesWithDimensions = nextNodes.filter(
(node) => (node.width || node.initialWidth) && (node.height || node.initialHeight)
);
// @todo users nodeOrigin should be used here
const bounds = getNodesBounds(nodesWithDimensions, { nodeOrigin: [0, 0] });
const { x, y, zoom } = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
@@ -113,6 +115,7 @@ const getInitialState = ({
onSelectionChangeHandlers: [],
lib: 'react',
debug: false,
};
};