fix(fitView): don't let defaultPosition overwrite fitView on load #533
This commit is contained in:
@@ -188,6 +188,9 @@ const GraphView = ({
|
||||
zoomOnScroll,
|
||||
zoomOnDoubleClick,
|
||||
paneMoveable,
|
||||
defaultPosition,
|
||||
defaultZoom,
|
||||
translateExtent,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -205,16 +208,6 @@ const GraphView = ({
|
||||
});
|
||||
}
|
||||
|
||||
const initialTransform = {
|
||||
x: defaultPosition[0],
|
||||
y: defaultPosition[1],
|
||||
k: defaultZoom,
|
||||
};
|
||||
|
||||
if (initialTransform.x !== 0 || initialTransform.y !== 0 || initialTransform.k !== 1) {
|
||||
setInitTransform(initialTransform);
|
||||
}
|
||||
|
||||
isInitialised.current = true;
|
||||
}
|
||||
}, [d3Initialised, onLoad]);
|
||||
|
||||
Reference in New Issue
Block a user