fix: arrow binding behaving unexpectedly on pointerup (#9010)

* fix: arrow binding behaving unexpectedly on pointerup

* update snaps
pull/7707/merge
David Luzar 2 weeks ago committed by GitHub
parent 00b5b0a0ca
commit 46f42ef8d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -95,7 +95,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 33.519031369643244, "height": 35,
"id": Any<String>, "id": Any<String>,
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@ -109,8 +109,8 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
0.5, 0.5,
], ],
[ [
382.47606040672997, 394.5,
34.019031369643244, 34.5,
], ],
], ],
"roughness": 1, "roughness": 1,
@ -128,9 +128,9 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 7, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 381.97606040672997, "width": 395,
"x": 247, "x": 247,
"y": 420, "y": 420,
} }
@ -167,7 +167,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
0, 0,
], ],
[ [
389.5, 399.5,
0, 0,
], ],
], ],
@ -186,10 +186,10 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 6, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 390, "width": 400,
"x": 237, "x": 227,
"y": 450, "y": 450,
} }
`; `;
@ -319,7 +319,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"verticalAlign": "top", "verticalAlign": "top",
"width": 100, "width": 100,
"x": 560, "x": 560,
"y": 236.95454545454544, "y": 226.5,
} }
`; `;
@ -339,13 +339,13 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"endBinding": { "endBinding": {
"elementId": "text-2", "elementId": "text-2",
"fixedPoint": null, "fixedPoint": null,
"focus": 1.625925925925924, "focus": 0,
"gap": 14, "gap": 14,
}, },
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 18.278619528619487, "height": 0,
"id": Any<String>, "id": Any<String>,
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@ -356,11 +356,11 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"points": [ "points": [
[ [
0.5, 0.5,
-0.5, 0,
], ],
[ [
357.2037037037038, 99.5,
-17.778619528619487, 0,
], ],
], ],
"roughness": 1, "roughness": 1,
@ -378,11 +378,11 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 6, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 357.7037037037038, "width": 100,
"x": 171, "x": 255,
"y": 249.45454545454544, "y": 239,
} }
`; `;
@ -482,7 +482,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 6, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 100, "width": 100,
"x": 255, "x": 255,
@ -660,7 +660,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 6, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 100, "width": 100,
"x": 255, "x": 255,
@ -1505,7 +1505,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
0, 0,
], ],
[ [
270.98528125, 272.485,
0, 0,
], ],
], ],
@ -1526,10 +1526,10 @@ exports[`Test Transform > should transform the elements correctly when linear el
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 7, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 270.48528125, "width": 272.985,
"x": 112.76171875, "x": 111.262,
"y": 57, "y": 57,
} }
`; `;
@ -1587,11 +1587,11 @@ exports[`Test Transform > should transform the elements correctly when linear el
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 6, "version": 4,
"versionNonce": Any<Number>, "versionNonce": Any<Number>,
"width": 0, "width": 0,
"x": 83.015625, "x": 77.017,
"y": 81.5, "y": 79,
} }
`; `;

@ -504,12 +504,6 @@ export const bindLinearElement = (
}), }),
}); });
} }
// update bound elements to make sure the binding tips are in sync with
// the normalized gap from above
if (!isElbowArrow(linearElement)) {
updateBoundElements(hoveredElement, elementsMap);
}
}; };
// Don't bind both ends of a simple segment // Don't bind both ends of a simple segment

@ -197,7 +197,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 125, "height": 99,
"id": "id166", "id": "id166",
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@ -211,8 +211,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0, 0,
], ],
[ [
125, "98.20800",
125, 99,
], ],
], ],
"roughness": 1, "roughness": 1,
@ -226,9 +226,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 47, "version": 40,
"width": 125, "width": "98.20800",
"x": 0, "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -298,7 +298,7 @@ History {
"focus": "0.00990", "focus": "0.00990",
"gap": 1, "gap": 1,
}, },
"height": "0.98000", "height": "0.98017",
"points": [ "points": [
[ [
0, 0,
@ -306,7 +306,7 @@ History {
], ],
[ [
98, 98,
"-0.98000", "-0.98017",
], ],
], ],
"startBinding": { "startBinding": {
@ -320,10 +320,10 @@ History {
"endBinding": { "endBinding": {
"elementId": "id165", "elementId": "id165",
"fixedPoint": null, "fixedPoint": null,
"focus": "-0.02040", "focus": "-0.02000",
"gap": 1, "gap": 1,
}, },
"height": "0.02000", "height": "0.00169",
"points": [ "points": [
[ [
0, 0,
@ -331,13 +331,13 @@ History {
], ],
[ [
98, 98,
"0.02000", "0.00169",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id164", "elementId": "id164",
"fixedPoint": null, "fixedPoint": null,
"focus": "0.01959", "focus": "0.02000",
"gap": 1, "gap": 1,
}, },
}, },
@ -393,20 +393,18 @@ History {
"focus": 0, "focus": 0,
"gap": 1, "gap": 1,
}, },
"height": 125, "height": 99,
"points": [ "points": [
[ [
0, 0,
0, 0,
], ],
[ [
125, "98.20800",
125, 99,
], ],
], ],
"startBinding": null, "startBinding": null,
"width": 125,
"x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -416,7 +414,7 @@ History {
"focus": "0.00990", "focus": "0.00990",
"gap": 1, "gap": 1,
}, },
"height": "0.98000", "height": "0.98161",
"points": [ "points": [
[ [
0, 0,
@ -424,7 +422,7 @@ History {
], ],
[ [
98, 98,
"-0.98000", "-0.98161",
], ],
], ],
"startBinding": { "startBinding": {
@ -433,9 +431,7 @@ History {
"focus": "0.02970", "focus": "0.02970",
"gap": 1, "gap": 1,
}, },
"width": 98, "y": "0.99245",
"x": 1,
"y": "0.99000",
}, },
}, },
"id169" => Delta { "id169" => Delta {
@ -827,9 +823,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 37, "version": 30,
"width": 100, "width": 0,
"x": 150, "x": 200,
"y": 0, "y": 0,
} }
`; `;
@ -866,8 +862,6 @@ History {
0, 0,
], ],
], ],
"width": 0,
"x": 149,
}, },
"inserted": { "inserted": {
"points": [ "points": [
@ -876,12 +870,10 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
"width": "98.00000",
"x": "1.00000",
}, },
}, },
}, },
@ -938,8 +930,6 @@ History {
], ],
], ],
"startBinding": null, "startBinding": null,
"width": 100,
"x": 150,
}, },
"inserted": { "inserted": {
"endBinding": { "endBinding": {
@ -964,8 +954,6 @@ History {
"focus": 0, "focus": 0,
"gap": 1, "gap": 1,
}, },
"width": 0,
"x": 149,
}, },
}, },
}, },
@ -2375,9 +2363,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 12, "version": 10,
"width": 498, "width": 498,
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -2516,7 +2504,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -2535,8 +2523,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -15179,9 +15167,9 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 12, "version": 10,
"width": "98.00000", "width": "98.00000",
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -15220,7 +15208,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -15233,7 +15221,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -15529,7 +15517,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -15548,8 +15536,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -15878,9 +15866,9 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 12, "version": 10,
"width": "98.00000", "width": "98.00000",
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -16152,7 +16140,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -16171,8 +16159,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -16501,9 +16489,9 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 12, "version": 10,
"width": "98.00000", "width": "98.00000",
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -16775,7 +16763,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -16794,8 +16782,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -17122,9 +17110,9 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 12, "version": 10,
"width": "98.00000", "width": "98.00000",
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -17180,7 +17168,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -17198,7 +17186,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -17467,7 +17455,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -17486,8 +17474,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {
@ -17840,9 +17828,9 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 13, "version": 11,
"width": "98.00000", "width": "98.00000",
"x": "1.00000", "x": 1,
"y": 0, "y": 0,
} }
`; `;
@ -17913,7 +17901,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -17932,7 +17920,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -18201,7 +18189,7 @@ History {
0, 0,
], ],
[ [
"98.00000", 100,
0, 0,
], ],
], ],
@ -18220,8 +18208,8 @@ History {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"width": "98.00000", "width": 100,
"x": 1, "x": 0,
"y": 0, "y": 0,
}, },
"inserted": { "inserted": {

@ -173,7 +173,7 @@ exports[`move element > rectangles with binding arrow 6`] = `
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 7, "version": 7,
"versionNonce": 2066753033, "versionNonce": 745419401,
"width": 300, "width": 300,
"x": 201, "x": 201,
"y": 2, "y": 2,
@ -232,8 +232,8 @@ exports[`move element > rectangles with binding arrow 7`] = `
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 15, "version": 11,
"versionNonce": 271613161, "versionNonce": 1996028265,
"width": 81, "width": 81,
"x": 110, "x": 110,
"y": 50, "y": 50,

Loading…
Cancel
Save