fix(core): check if transform changed before applying
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -645,13 +645,14 @@ export function useActions(
|
|||||||
|
|
||||||
const constrainedTransform = d3Zoom.constrain()(nextTransform, extent, translateExtent)
|
const constrainedTransform = d3Zoom.constrain()(nextTransform, extent, translateExtent)
|
||||||
|
|
||||||
d3Zoom.transform(d3Selection, constrainedTransform)
|
const transformChanged =
|
||||||
|
|
||||||
return (
|
|
||||||
state.viewport.x !== constrainedTransform.x ||
|
state.viewport.x !== constrainedTransform.x ||
|
||||||
state.viewport.y !== constrainedTransform.y ||
|
state.viewport.y !== constrainedTransform.y ||
|
||||||
state.viewport.zoom !== constrainedTransform.k
|
state.viewport.zoom !== constrainedTransform.k
|
||||||
)
|
|
||||||
|
d3Zoom.transform(d3Selection, constrainedTransform)
|
||||||
|
|
||||||
|
return transformChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
const setState: Actions['setState'] = (options) => {
|
const setState: Actions['setState'] = (options) => {
|
||||||
@@ -823,12 +824,7 @@ export function useActions(
|
|||||||
project: (position) => viewportHelper.project(position),
|
project: (position) => viewportHelper.project(position),
|
||||||
toObject,
|
toObject,
|
||||||
updateNodeInternals,
|
updateNodeInternals,
|
||||||
$reset: () => {
|
$reset: () => {},
|
||||||
state.edges = []
|
|
||||||
state.nodes = []
|
|
||||||
|
|
||||||
setState(useState())
|
|
||||||
},
|
|
||||||
$destroy: () => {},
|
$destroy: () => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user