Skip to content

开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.

feat(component): fit viewport after children updated (#104)

pubuzhixing83caad342adcf
diff --git a/packages/react-board/src/wrapper.tsx b/packages/react-board/src/wrapper.tsx
index adf4a95..72c07b0 100644
--- a/packages/react-board/src/wrapper.tsx
+++ b/packages/react-board/src/wrapper.tsx
@@ -28,6 +28,7 @@ import {
withI18n,
updateViewBox,
FLUSHING,
+ BoardTransforms,
} from '@plait/core';
import { BoardChangeData } from './plugins/board';
import { useCallback, useEffect, useRef, useState } from 'react';
@@ -198,6 +199,7 @@ export const Wrapper: React.FC<WrapperProps> = ({
parent: board,
parentG: PlaitBoard.getElementHost(board),
});
+ BoardTransforms.fitViewport(board);
}
}, [value]);