Implement #7978: Add double click event to rescale and replace the viewer

This commit is contained in:
Eric NGUYEN 2023-01-25 15:33:49 +01:00
parent caa680b511
commit 4053763e44

View file

@ -109,6 +109,9 @@ export function SVG(props: ISVGProps): JSX.Element {
const value = event as Value;
setScale(value.a);
}}
onDoubleClick={() => {
svgViewer?.current?.setPointOnViewerCenter(props.width / 2, props.height / 2, 0.8);
}}
background={'#ffffff'}
defaultTool='pan'
miniatureProps={{
@ -131,6 +134,7 @@ export function SVG(props: ISVGProps): JSX.Element {
function UseFitOnce(svgViewer: React.RefObject<ReactSVGPanZoom>, width: number, height: number): void {
React.useEffect(() => {
svgViewer?.current?.fitToViewer();
// TODO: Fix this
svgViewer?.current?.setPointOnViewerCenter(width / 2, height / 2, 0.8);
}, [svgViewer, width, height]);
}