Merge branch 'master' of https://github.com/alexdawes/react-flow into alexdawes-master
This commit is contained in:
+3
-2
@@ -403,8 +403,9 @@ export const storeModel: StoreModel = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bounds = getRectOfNodes(nodes);
|
const bounds = getRectOfNodes(nodes);
|
||||||
const maxBoundsSize = Math.max(bounds.width, bounds.height);
|
const xZoom = width / (bounds.width * (1 + padding));
|
||||||
const zoom = Math.min(width, height) / (maxBoundsSize + maxBoundsSize * padding);
|
const yZoom = height / (bounds.height * (1 + padding));
|
||||||
|
const zoom = Math.min(xZoom, yZoom);
|
||||||
const clampedZoom = clamp(zoom, minZoom, maxZoom);
|
const clampedZoom = clamp(zoom, minZoom, maxZoom);
|
||||||
const boundsCenterX = bounds.x + bounds.width / 2;
|
const boundsCenterX = bounds.x + bounds.width / 2;
|
||||||
const boundsCenterY = bounds.y + bounds.height / 2;
|
const boundsCenterY = bounds.y + bounds.height / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user