Implement #7978: Add double click event to rescale and replace the viewer
This commit is contained in:
parent
caa680b511
commit
4053763e44
1 changed files with 5 additions and 1 deletions
|
@ -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]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue