feat(svelte) add fitViewOptions, closes #3440
This commit is contained in:
@@ -160,7 +160,7 @@ export const getTransformForBounds = (
|
||||
height: number,
|
||||
minZoom: number,
|
||||
maxZoom: number,
|
||||
padding = 0.1
|
||||
padding: number
|
||||
): Transform => {
|
||||
const xZoom = width / (bounds.width * (1 + padding));
|
||||
const yZoom = height / (bounds.height * (1 + padding));
|
||||
|
||||
@@ -180,10 +180,11 @@ export function fitView<Params extends FitViewParamsBase<NodeBase>, Options exte
|
||||
return isVisible;
|
||||
});
|
||||
|
||||
const nodesInitialized = filteredNodes.every((n) => n.width && n.height);
|
||||
console.log(filteredNodes);
|
||||
|
||||
if (nodes.length > 0 && nodesInitialized) {
|
||||
const bounds = getRectOfNodes(nodes, nodeOrigin);
|
||||
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