feat(editor): visualize binding midpoints + support for simple arrows (#10611)
* feat: Force exact center focus point When the projected point is close to center snap it to the exact center. Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Tests Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Snap to center around side mid point. Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * Trigger CI * fix: Midpoint outline focus point Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Tests Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Dragging existing arrow reset focus point on outline Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Tests Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Midpoint indicator Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Rotated mid points Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: No hole Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Cache hits and scene lookups Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * chore: Remove debug Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Consider hit threshold and inside override too Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Increase outline midpoint sticky distance Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Don't show midpoint indicator when no snapping is possible Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Indicate lock-in Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * chore: Remove Map caching Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: incorrect threshold Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: threshold setting Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Hit caching Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Simple arrow mid point selection inconsistency Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: cache override Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Precise know dragging with midpoint refactor Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fear: Frame support Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Crossing arrow won't trigger mid point Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Arrow creation point highlight Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Restore types & tests Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * chore: Restore restore.ts Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: restore.ts Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Elbow arrows reliably highlight center point Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Highlight point ordering Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Bind with focus point across shape Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Lint * fix: Midpoint and binding alignment Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * chore: Indicator color Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * chore: More knob tuning Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Radius Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix: Tests Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * simplify point indicators --------- Signed-off-by: Mark Tolmacs <mark@lazycat.hu> Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
@@ -227,7 +227,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"strokeWidth": 2,
|
||||
"type": "arrow",
|
||||
"updated": 1,
|
||||
"version": 34,
|
||||
"version": 33,
|
||||
"width": "94.00000",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
@@ -334,7 +334,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"height": "74.35962",
|
||||
"height": "105.58873",
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
@@ -342,50 +342,50 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
[
|
||||
88,
|
||||
"74.35962",
|
||||
"105.58873",
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 33,
|
||||
"version": 32,
|
||||
"width": 88,
|
||||
},
|
||||
"inserted": {
|
||||
"endBinding": {
|
||||
"elementId": "id1",
|
||||
"fixedPoint": [
|
||||
"0.39746",
|
||||
"0.60254",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"height": "1.66245",
|
||||
"height": "0.00000",
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
],
|
||||
[
|
||||
88,
|
||||
"-1.66245",
|
||||
"88.00000",
|
||||
"0.00000",
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 30,
|
||||
"width": 88,
|
||||
"version": 29,
|
||||
"width": "88.00000",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -440,13 +440,13 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
],
|
||||
"startBinding": null,
|
||||
"version": 34,
|
||||
"version": 33,
|
||||
"width": "94.00000",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
},
|
||||
"inserted": {
|
||||
"height": "74.35962",
|
||||
"height": "105.58873",
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
@@ -454,21 +454,21 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
[
|
||||
88,
|
||||
"74.35962",
|
||||
"105.58873",
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 33,
|
||||
"version": 32,
|
||||
"width": 88,
|
||||
"x": 6,
|
||||
"y": "46.67801",
|
||||
"y": "7.09000",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -854,7 +854,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"strokeWidth": 2,
|
||||
"type": "arrow",
|
||||
"updated": 1,
|
||||
"version": 26,
|
||||
"version": 30,
|
||||
"width": 100,
|
||||
"x": 150,
|
||||
"y": 0,
|
||||
@@ -904,60 +904,60 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"id4": {
|
||||
"deleted": {
|
||||
"endBinding": null,
|
||||
"height": "5.28000",
|
||||
"height": "0.00293",
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
],
|
||||
[
|
||||
-44,
|
||||
"-5.28000",
|
||||
"-44.00000",
|
||||
"-0.00293",
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 25,
|
||||
"width": 44,
|
||||
"y": "5.28000",
|
||||
"version": 29,
|
||||
"width": "44.00000",
|
||||
"y": "0.00293",
|
||||
},
|
||||
"inserted": {
|
||||
"endBinding": {
|
||||
"elementId": "id1",
|
||||
"fixedPoint": [
|
||||
"0.41067",
|
||||
"0.58933",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"height": "9.80848",
|
||||
"height": 0,
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
],
|
||||
[
|
||||
"47.06697",
|
||||
"9.80848",
|
||||
"6.00000",
|
||||
0,
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 24,
|
||||
"width": "47.06697",
|
||||
"y": "-0.87545",
|
||||
"version": 27,
|
||||
"width": "6.00000",
|
||||
"y": "0.01000",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1004,35 +1004,35 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
],
|
||||
"startBinding": null,
|
||||
"version": 26,
|
||||
"version": 30,
|
||||
"width": 100,
|
||||
"x": 150,
|
||||
"y": 0,
|
||||
},
|
||||
"inserted": {
|
||||
"height": "5.28000",
|
||||
"height": "0.00293",
|
||||
"points": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
],
|
||||
[
|
||||
-44,
|
||||
"-5.28000",
|
||||
"-44.00000",
|
||||
"-0.00293",
|
||||
],
|
||||
],
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.63636",
|
||||
"0.63636",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"version": 25,
|
||||
"width": 44,
|
||||
"version": 29,
|
||||
"width": "44.00000",
|
||||
"x": 144,
|
||||
"y": "5.28000",
|
||||
"y": "0.00293",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -2390,7 +2390,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"endBinding": {
|
||||
"elementId": "id1",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -2398,7 +2398,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "398.76619",
|
||||
"height": "439.13521",
|
||||
"id": "id4",
|
||||
"index": "a2",
|
||||
"isDeleted": false,
|
||||
@@ -2413,7 +2413,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
[
|
||||
488,
|
||||
"-398.76619",
|
||||
"-439.13521",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -2434,16 +2434,16 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"strokeWidth": 2,
|
||||
"type": "arrow",
|
||||
"updated": 1,
|
||||
"version": 12,
|
||||
"version": 13,
|
||||
"width": 488,
|
||||
"x": 6,
|
||||
"y": "-4.89286",
|
||||
"y": "-5.38920",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of elements 1`] = `3`;
|
||||
|
||||
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `11`;
|
||||
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `12`;
|
||||
|
||||
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] redo stack 1`] = `[]`;
|
||||
|
||||
@@ -2558,7 +2558,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"endBinding": {
|
||||
"elementId": "id1",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -2566,7 +2566,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "398.76619",
|
||||
"height": "439.13521",
|
||||
"index": "a2",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -2579,7 +2579,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
],
|
||||
[
|
||||
488,
|
||||
"-398.76619",
|
||||
"-439.13521",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -2599,14 +2599,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"type": "arrow",
|
||||
"version": 12,
|
||||
"version": 13,
|
||||
"width": 488,
|
||||
"x": 6,
|
||||
"y": "-4.89286",
|
||||
"y": "-5.38920",
|
||||
},
|
||||
"inserted": {
|
||||
"isDeleted": true,
|
||||
"version": 9,
|
||||
"version": 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -16375,7 +16375,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16383,7 +16383,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"id": "id13",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
@@ -16398,7 +16398,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -16409,7 +16409,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16422,7 +16422,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -16458,7 +16458,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16467,7 +16467,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16478,7 +16478,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16487,7 +16487,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16793,7 +16793,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -16801,7 +16801,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00611",
|
||||
"height": "0.00936",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -16814,7 +16814,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
88,
|
||||
"0.00611",
|
||||
"0.00936",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -16825,7 +16825,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17126,7 +17126,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17134,7 +17134,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"id": "id13",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
@@ -17149,7 +17149,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -17160,7 +17160,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17173,7 +17173,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -17434,7 +17434,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17442,7 +17442,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -17455,7 +17455,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -17466,7 +17466,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17478,7 +17478,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
},
|
||||
"inserted": {
|
||||
"isDeleted": true,
|
||||
@@ -17775,7 +17775,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17783,7 +17783,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"id": "id13",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
@@ -17798,7 +17798,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -17809,7 +17809,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -17822,7 +17822,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -18083,7 +18083,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18091,7 +18091,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -18104,7 +18104,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -18115,7 +18115,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18127,7 +18127,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
},
|
||||
"inserted": {
|
||||
"isDeleted": true,
|
||||
@@ -18422,7 +18422,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18430,7 +18430,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"id": "id13",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
@@ -18445,7 +18445,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -18456,7 +18456,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18469,7 +18469,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 12,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -18522,7 +18522,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18530,7 +18530,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18541,7 +18541,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18816,7 +18816,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -18824,7 +18824,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00611",
|
||||
"height": "0.00936",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -18837,7 +18837,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
88,
|
||||
"0.00611",
|
||||
"0.00936",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -18848,7 +18848,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19177,7 +19177,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19185,7 +19185,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00092",
|
||||
"height": "0.00004",
|
||||
"id": "id13",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
@@ -19200,7 +19200,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
"88.00000",
|
||||
"0.00092",
|
||||
"0.00004",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -19211,7 +19211,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19224,7 +19224,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"version": 13,
|
||||
"width": "88.00000",
|
||||
"x": 6,
|
||||
"y": "0.00849",
|
||||
"y": "0.00996",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -19288,7 +19288,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19296,7 +19296,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19567,7 +19567,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"endBinding": {
|
||||
"elementId": "id2",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
0,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
@@ -19575,7 +19575,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "0.00611",
|
||||
"height": "0.00936",
|
||||
"index": "a3",
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
@@ -19588,7 +19588,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
],
|
||||
[
|
||||
88,
|
||||
"0.00611",
|
||||
"0.00936",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -19599,7 +19599,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
|
||||
"startBinding": {
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"0.50010",
|
||||
1,
|
||||
"0.50010",
|
||||
],
|
||||
"mode": "orbit",
|
||||
|
||||
@@ -182,14 +182,14 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||
"elementId": "id3",
|
||||
"fixedPoint": [
|
||||
"-0.02000",
|
||||
"0.44667",
|
||||
"0.47904",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": "90.00000",
|
||||
"height": "90.02554",
|
||||
"id": "id6",
|
||||
"index": "a2",
|
||||
"isDeleted": false,
|
||||
@@ -204,7 +204,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||
],
|
||||
[
|
||||
89,
|
||||
"90.00000",
|
||||
"90.02554",
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
@@ -217,7 +217,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||
"elementId": "id0",
|
||||
"fixedPoint": [
|
||||
"1.06000",
|
||||
"0.46000",
|
||||
"0.55687",
|
||||
],
|
||||
"mode": "orbit",
|
||||
},
|
||||
@@ -230,6 +230,6 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||
"versionNonce": 271613161,
|
||||
"width": 89,
|
||||
"x": 106,
|
||||
"y": "46.00000",
|
||||
"y": "55.68677",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1590,7 +1590,7 @@ describe("history", () => {
|
||||
expect(API.getUndoStack().length).toBe(5);
|
||||
expect(arrow.startBinding).toEqual({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([1, 0.5001]),
|
||||
mode: "orbit",
|
||||
});
|
||||
expect(arrow.endBinding).toEqual({
|
||||
@@ -1613,7 +1613,7 @@ describe("history", () => {
|
||||
expect(API.getRedoStack().length).toBe(1);
|
||||
expect(arrow.startBinding).toEqual({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([1, 0.5001]),
|
||||
mode: "orbit",
|
||||
});
|
||||
expect(arrow.endBinding).toEqual({
|
||||
@@ -1636,7 +1636,7 @@ describe("history", () => {
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
expect(arrow.startBinding).toEqual({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([1, 0.5001]),
|
||||
mode: "orbit",
|
||||
});
|
||||
expect(arrow.endBinding).toEqual({
|
||||
@@ -1667,7 +1667,7 @@ describe("history", () => {
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
expect(arrow.startBinding).toEqual({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([1, 0.5001]),
|
||||
mode: "orbit",
|
||||
});
|
||||
expect(arrow.endBinding).toEqual({
|
||||
@@ -1690,7 +1690,7 @@ describe("history", () => {
|
||||
expect(API.getRedoStack().length).toBe(1);
|
||||
expect(arrow.startBinding).toEqual({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([1, 0.5001]),
|
||||
mode: "orbit",
|
||||
});
|
||||
expect(arrow.endBinding).toEqual({
|
||||
@@ -4510,20 +4510,20 @@ describe("history", () => {
|
||||
|
||||
// create start binding
|
||||
mouse.downAt(0, 0);
|
||||
mouse.moveTo(0, 10);
|
||||
mouse.moveTo(0, 10);
|
||||
mouse.moveTo(0, 3);
|
||||
mouse.moveTo(0, 3);
|
||||
mouse.up();
|
||||
|
||||
// create end binding
|
||||
mouse.downAt(100, 0);
|
||||
mouse.moveTo(100, 10);
|
||||
mouse.moveTo(100, 10);
|
||||
mouse.moveTo(100, 3);
|
||||
mouse.moveTo(100, 3);
|
||||
mouse.up();
|
||||
|
||||
expect(
|
||||
(h.elements[2] as ExcalidrawElbowArrowElement).startBinding
|
||||
?.fixedPoint,
|
||||
).not.toEqual([1, 0.5001]);
|
||||
).toEqual([1, 0.5001]);
|
||||
expect(
|
||||
(h.elements[2] as ExcalidrawElbowArrowElement).startBinding?.mode,
|
||||
).toBe("orbit");
|
||||
@@ -4623,12 +4623,12 @@ describe("history", () => {
|
||||
id: arrowId,
|
||||
startBinding: expect.objectContaining({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: [0.6363636363636364, 0.6363636363636364],
|
||||
fixedPoint: [1, 0.5001],
|
||||
mode: "orbit",
|
||||
}),
|
||||
endBinding: expect.objectContaining({
|
||||
elementId: rect2.id,
|
||||
fixedPoint: [0.4106696643494564, 0.5893303356505437],
|
||||
fixedPoint: [0, 0.5001],
|
||||
mode: "orbit",
|
||||
}),
|
||||
}),
|
||||
@@ -4666,13 +4666,13 @@ describe("history", () => {
|
||||
|
||||
// create start binding
|
||||
mouse.downAt(0, 0);
|
||||
mouse.moveTo(0, 10);
|
||||
mouse.upAt(0, 10);
|
||||
mouse.moveTo(0, 3);
|
||||
mouse.upAt(0, 3);
|
||||
|
||||
// create end binding
|
||||
mouse.downAt(100, 0);
|
||||
mouse.moveTo(100, 10);
|
||||
mouse.upAt(100, 10);
|
||||
mouse.moveTo(100, 3);
|
||||
mouse.upAt(100, 3);
|
||||
|
||||
expect(h.elements).toEqual(
|
||||
expect.arrayContaining([
|
||||
@@ -4766,13 +4766,13 @@ describe("history", () => {
|
||||
id: arrowId,
|
||||
startBinding: expect.objectContaining({
|
||||
elementId: rect1.id,
|
||||
fixedPoint: [0.6363636363636364, 0.6363636363636364],
|
||||
fixedPoint: [1, 0.5001],
|
||||
mode: "orbit",
|
||||
}),
|
||||
// rebound with previous rectangle
|
||||
endBinding: expect.objectContaining({
|
||||
elementId: rect2.id,
|
||||
fixedPoint: [0.39746300211416496, 0.6025369978858351],
|
||||
fixedPoint: [0, 0.5001],
|
||||
mode: "orbit",
|
||||
}),
|
||||
}),
|
||||
@@ -5031,8 +5031,9 @@ describe("history", () => {
|
||||
// bind arrow to rect1 and rect2
|
||||
UI.clickTool("arrow");
|
||||
mouse.down(0, 0);
|
||||
mouse.moveTo(50, 0);
|
||||
mouse.up(50, 0);
|
||||
mouse.moveTo(25, 0);
|
||||
mouse.moveTo(47, 0);
|
||||
mouse.up(47, 0);
|
||||
|
||||
const arrowId = h.elements[2].id;
|
||||
|
||||
@@ -5055,7 +5056,7 @@ describe("history", () => {
|
||||
}),
|
||||
endBinding: expect.objectContaining({
|
||||
elementId: rect2.id,
|
||||
fixedPoint: expect.arrayContaining([0.5001, 0.5001]),
|
||||
fixedPoint: expect.arrayContaining([0, 0.5001]),
|
||||
}),
|
||||
isDeleted: true,
|
||||
}),
|
||||
|
||||
@@ -78,7 +78,7 @@ describe("move element", () => {
|
||||
// create elements
|
||||
const rectA = UI.createElement("rectangle", { size: 100 });
|
||||
const rectB = UI.createElement("rectangle", { x: 200, y: 0, size: 300 });
|
||||
const arrow = UI.createElement("arrow", { x: 110, y: 50, size: 80 });
|
||||
const arrow = UI.createElement("arrow", { x: 105, y: 50, size: 88 });
|
||||
|
||||
act(() => {
|
||||
// bind line to two rectangles
|
||||
@@ -110,7 +110,10 @@ describe("move element", () => {
|
||||
expect(h.state.selectedElementIds[rectB.id]).toBeTruthy();
|
||||
expect([rectA.x, rectA.y]).toEqual([0, 0]);
|
||||
expect([rectB.x, rectB.y]).toEqual([200, 0]);
|
||||
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints([[106, 46]], 0);
|
||||
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints(
|
||||
[[106.00000000000001, 55.6867741935484]],
|
||||
0,
|
||||
);
|
||||
expect([[arrow.width, arrow.height]]).toCloselyEqualPoints([[88, 88]], 0);
|
||||
|
||||
renderInteractiveScene.mockClear();
|
||||
@@ -129,11 +132,11 @@ describe("move element", () => {
|
||||
expect(h.state.selectedElementIds[rectB.id]).toBeTruthy();
|
||||
expect([rectA.x, rectA.y]).toEqual([0, 0]);
|
||||
expect([rectB.x, rectB.y]).toEqual([201, 2]);
|
||||
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints([[106, 46]], 0);
|
||||
expect([[arrow.width, arrow.height]]).toCloselyEqualPoints(
|
||||
[[79, 124.1678]],
|
||||
2,
|
||||
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints(
|
||||
[[106, 55.6867741935484]],
|
||||
0,
|
||||
);
|
||||
expect([[arrow.width, arrow.height]]).toCloselyEqualPoints([[89, 90]], 0);
|
||||
|
||||
h.elements.forEach((element) => expect(element).toMatchSnapshot());
|
||||
});
|
||||
|
||||
@@ -80,6 +80,6 @@ test("unselected bound arrows update when rotating their target elements", async
|
||||
expect(textArrow.x).toEqual(360);
|
||||
expect(textArrow.y).toEqual(300);
|
||||
expect(textArrow.points[0]).toEqual([0, 0]);
|
||||
expect(textArrow.points[1][0]).toBeCloseTo(-98.87, 0);
|
||||
expect(textArrow.points[1][1]).toBeCloseTo(-123.65, 0);
|
||||
expect(textArrow.points[1][0]).toBeCloseTo(-95.4635969899922, 0);
|
||||
expect(textArrow.points[1][1]).toBeCloseTo(-126.8785027399889, 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user