fix(handles): calculate correct position

This commit is contained in:
moklick
2022-07-14 20:21:08 +02:00
parent c69254a80a
commit 8d866ec675
2 changed files with 14 additions and 18 deletions
+5 -2
View File
@@ -45,6 +45,9 @@ const createStore = () =>
updateNodeDimensions: (updates: NodeDimensionUpdate[]) => {
const { onNodesChange, nodeInternals, fitViewOnInit, fitViewOnInitDone, fitViewOnInitOptions } = get();
const style = window.getComputedStyle(document.querySelector('.react-flow__viewport')!);
const { m22: zoom } = new window.DOMMatrixReadOnly(style.transform);
const changes: NodeDimensionChange[] = updates.reduce<NodeDimensionChange[]>((res, update) => {
const node = nodeInternals.get(update.id);
@@ -62,8 +65,8 @@ const createStore = () =>
[internalsSymbol]: {
...node[internalsSymbol],
handleBounds: {
source: getHandleBounds('.source', update.nodeElement),
target: getHandleBounds('.target', update.nodeElement),
source: getHandleBounds('.source', update.nodeElement, zoom),
target: getHandleBounds('.target', update.nodeElement, zoom),
},
},
...dimensions,