mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2025-12-24 15:09:03 -05:00
fix: fixes issue with connector path not being generated correctly
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user