Merge pull request #5191 from xyflow/fix/fit-view-padding
Fix legacy fitView padding
This commit is contained in:
7
.changeset/thin-geese-hope.md
Normal file
7
.changeset/thin-geese-hope.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@xyflow/system': patch
|
||||
'@xyflow/react': patch
|
||||
'@xyflow/svelte': patch
|
||||
---
|
||||
|
||||
Fix legacy padding being slightly larger than before
|
||||
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user