From c96f77f9cb5a2e952a86b6deb90386bbb0b81e98 Mon Sep 17 00:00:00 2001 From: Dennis Collaris <d.a.c.collaris@uu.nl> Date: Sat, 16 Nov 2024 14:37:17 +0000 Subject: [PATCH] fix: max zoom for schema layout --- libs/shared/lib/schema/panel/Schema.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libs/shared/lib/schema/panel/Schema.tsx b/libs/shared/lib/schema/panel/Schema.tsx index c13f95409..35d34121e 100644 --- a/libs/shared/lib/schema/panel/Schema.tsx +++ b/libs/shared/lib/schema/panel/Schema.tsx @@ -27,10 +27,6 @@ interface Props { onRemove?: () => void; } -const onInit = (reactFlowInstance: ReactFlowInstance) => { - setTimeout(() => reactFlowInstance.fitView(), 100); -}; - const graphEntityPillNodeTypes = { entity: SchemaEntityPill, relation: SchemaRelationPill, @@ -92,9 +88,10 @@ export const Schema = (props: Props) => { layout.current = layoutFactory.createLayout(settings.layoutName); } + const maxZoom = 1.2; const fitView = () => { if (reactFlowInstanceRef.current) { - reactFlowInstanceRef.current.fitView(); + reactFlowInstanceRef.current.fitView({maxZoom}); } }; @@ -376,7 +373,7 @@ export const Schema = (props: Props) => { edges={edges} onInit={(reactFlowInstance) => { reactFlowInstanceRef.current = reactFlowInstance; - onInit(reactFlowInstance); + setTimeout(() => fitView(), 100); }} onClick={handleOnClick} proOptions={{ hideAttribution: true }} -- GitLab