diff --git a/libs/shared/lib/schema/panel/Schema.tsx b/libs/shared/lib/schema/panel/Schema.tsx index c13f95409295348d948d34c54c4d26a5129b76bb..35d34121e6abbe75ca0459bc561ab3140f1d89ec 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 }}