mirror of
https://github.com/markmanx/isoflow.git
synced 2025-02-07 20:10:47 +00:00
fix: fixes issue with connector path not being generated correctly
This commit is contained in:
parent
0731757060
commit
425744585e
2 changed files with 38 additions and 9 deletions
|
@ -45,6 +45,12 @@ export const Connector: ModeActions = {
|
|||
id: itemAtTile.id
|
||||
}
|
||||
};
|
||||
|
||||
draft.connector.path = getConnectorPath({
|
||||
anchors: draft.connector.anchors,
|
||||
nodes: scene.nodes,
|
||||
allAnchors: getAllAnchors(scene.connectors)
|
||||
});
|
||||
});
|
||||
|
||||
uiState.actions.setMode(newMode);
|
||||
|
|
|
@ -4,7 +4,8 @@ import {
|
|||
getItemById,
|
||||
CoordsUtils,
|
||||
hasMovedTile,
|
||||
getAnchorParent
|
||||
getAnchorParent,
|
||||
getItemAtTile
|
||||
} from 'src/utils';
|
||||
|
||||
const dragItems = (
|
||||
|
@ -41,15 +42,37 @@ const dragItems = (
|
|||
item.id
|
||||
);
|
||||
|
||||
if (anchor.ref.type !== 'TILE') return;
|
||||
const itemAtTile = getItemAtTile({ tile, scene });
|
||||
|
||||
draft.anchors[anchorIndex] = {
|
||||
...anchor,
|
||||
ref: {
|
||||
type: 'TILE',
|
||||
coords: tile
|
||||
}
|
||||
};
|
||||
switch (itemAtTile?.type) {
|
||||
case 'NODE':
|
||||
draft.anchors[anchorIndex] = {
|
||||
...anchor,
|
||||
ref: {
|
||||
type: 'NODE',
|
||||
id: itemAtTile.id
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'CONNECTOR_ANCHOR':
|
||||
draft.anchors[anchorIndex] = {
|
||||
...anchor,
|
||||
ref: {
|
||||
type: 'ANCHOR',
|
||||
id: itemAtTile.id
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
draft.anchors[anchorIndex] = {
|
||||
...anchor,
|
||||
ref: {
|
||||
type: 'TILE',
|
||||
coords: tile
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
scene.actions.updateConnector(connector.id, newConnector);
|
||||
|
|
Loading…
Reference in a new issue