[v11.0.x] Canvas: Connection original persistence check (#87061)
Canvas: Connection original persistence check (#86476)
* Canvas: Connection original persistence check
* modify current connection state directly instead of copying and needing to call "onChange"
---------
Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
(cherry picked from commit 7590f4afe1)
Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
This commit is contained in:
co-authored by
Drew Slobodnjak
parent
9a91f303be
commit
73f86f1a7d
@@ -128,7 +128,7 @@ export const ConnectionSVG = ({
|
||||
// Render selected connection last, ensuring it is above other connections
|
||||
.sort((_a, b) => (selectedConnection === b && scene.panel.context.instanceState.selectedConnection ? -1 : 0))
|
||||
.map((v, idx) => {
|
||||
const { source, target, info, vertices } = v;
|
||||
const { source, target, info, vertices, index } = v;
|
||||
const sourceRect = source.div?.getBoundingClientRect();
|
||||
const parent = source.div?.parentElement;
|
||||
const transformScale = scene.scale;
|
||||
@@ -146,6 +146,15 @@ export const ConnectionSVG = ({
|
||||
yStart = v.sourceOriginal.y;
|
||||
xEnd = v.targetOriginal.x;
|
||||
yEnd = v.targetOriginal.y;
|
||||
} else if (source.options.connections) {
|
||||
// If original source or target coordinates are not set for the current connection, set them
|
||||
if (
|
||||
!source.options.connections[index].sourceOriginal ||
|
||||
!source.options.connections[index].targetOriginal
|
||||
) {
|
||||
source.options.connections[index].sourceOriginal = { x: x1, y: y1 };
|
||||
source.options.connections[index].targetOriginal = { x: x2, y: y2 };
|
||||
}
|
||||
}
|
||||
|
||||
const midpoint = calculateMidpoint(x1, y1, x2, y2);
|
||||
|
||||
Reference in New Issue
Block a user