mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
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>
This commit is contained in:
parent
4e6ba433de
commit
7590f4afe1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user