Merge pull request #5191 from xyflow/fix/fit-view-padding

Fix legacy fitView padding
This commit is contained in:
Moritz Klack
2025-04-14 13:42:29 +02:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
---
'@xyflow/system': patch
'@xyflow/react': patch
'@xyflow/svelte': patch
---
Fix legacy padding being slightly larger than before

View File

@@ -184,7 +184,7 @@ export const rendererPointToPoint = ({ x, y }: XYPosition, [tx, ty, tScale]: Tra
*/
function parsePadding(padding: PaddingWithUnit, viewport: number): number {
if (typeof padding === 'number') {
return Math.floor(viewport - viewport / (1 + padding));
return Math.floor((viewport - viewport / (1 + padding)) * 0.5);
}
if (typeof padding === 'string' && padding.endsWith('px')) {