fix: Elbow arrow z-index binding (#9067)

This commit is contained in:
Márk Tolmács 2025-02-01 19:21:03 +01:00 committed by GitHub
parent 86c67bd37f
commit 302664e500
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 165 additions and 31 deletions

View file

@ -5770,7 +5770,10 @@ class App extends React.Component<AppProps, AppState> {
});
}
if (editingLinearElement?.lastUncommittedPoint != null) {
this.maybeSuggestBindingAtCursor(scenePointer);
this.maybeSuggestBindingAtCursor(
scenePointer,
editingLinearElement.elbowed,
);
} else {
// causes stack overflow if not sync
flushSync(() => {
@ -5790,7 +5793,7 @@ class App extends React.Component<AppProps, AppState> {
this.state.startBoundElement,
);
} else {
this.maybeSuggestBindingAtCursor(scenePointer);
this.maybeSuggestBindingAtCursor(scenePointer, false);
}
}
@ -7728,6 +7731,7 @@ class App extends React.Component<AppProps, AppState> {
this.scene.getNonDeletedElementsMap(),
this.state.zoom,
isElbowArrow(element),
isElbowArrow(element),
);
this.scene.insertElement(element);
@ -10005,15 +10009,20 @@ class App extends React.Component<AppProps, AppState> {
}
};
private maybeSuggestBindingAtCursor = (pointerCoords: {
x: number;
y: number;
}): void => {
private maybeSuggestBindingAtCursor = (
pointerCoords: {
x: number;
y: number;
},
considerAll: boolean,
): void => {
const hoveredBindableElement = getHoveredElementForBinding(
pointerCoords,
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
this.state.zoom,
false,
considerAll,
);
this.setState({
suggestedBindings:
@ -10043,7 +10052,8 @@ class App extends React.Component<AppProps, AppState> {
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
this.state.zoom,
isArrowElement(linearElement) && isElbowArrow(linearElement),
isElbowArrow(linearElement),
isElbowArrow(linearElement),
);
if (
hoveredBindableElement != null &&