fix Suggested binding flicker

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-03-19 16:47:43 +00:00
parent de2ad7cd3f
commit 50099012c6
2 changed files with 15 additions and 13 deletions
@@ -244,7 +244,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id6",
"id": "id50",
"type": "arrow",
},
],
@@ -290,7 +290,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id6",
"id": "id50",
"type": "arrow",
},
],
@@ -335,7 +335,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id7",
"id": "id51",
"type": "text",
},
],
@@ -401,7 +401,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"autoResize": true,
"backgroundColor": "transparent",
"boundElements": null,
"containerId": "id6",
"containerId": "id50",
"customData": undefined,
"fillStyle": "solid",
"fontFamily": 5,
@@ -1316,7 +1316,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id11",
"id": "id56",
"type": "text",
},
{
@@ -1359,7 +1359,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id12",
"id": "id57",
"type": "text",
},
],
@@ -1398,7 +1398,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id13",
"id": "id58",
"type": "text",
},
{
@@ -1441,7 +1441,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id14",
"id": "id59",
"type": "text",
},
{
@@ -1488,7 +1488,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id15",
"id": "id60",
"type": "text",
},
],
@@ -1556,7 +1556,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id16",
"id": "id61",
"type": "text",
},
],
+5 -3
View File
@@ -6825,14 +6825,16 @@ class App extends React.Component<AppProps, AppState> {
return;
}
if (this.state.activeTool.type === "arrow") {
// Set suggested binding if we're hovering with an arrow tool
// and not dragging out a new element
if (this.state.activeTool.type === "arrow" && !this.state.newElement) {
const scenePointer = pointFrom<GlobalPoint>(scenePointerX, scenePointerY);
const hit = getHoveredElementForBinding(
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
scenePointer,
this.scene.getNonDeletedElements(),
this.scene.getNonDeletedElementsMap(),
maxBindingDistance_simple(this.state.zoom),
);
const scenePointer = pointFrom<GlobalPoint>(scenePointerX, scenePointerY);
const elementsMap = this.scene.getNonDeletedElementsMap();
if (hit && !isPointInElement(scenePointer, hit, elementsMap)) {
this.setState({