From 60cea7a0c26ef35c4cf33333d3b5e589c53ea0d8 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Sat, 29 May 2021 21:35:03 +0200 Subject: [PATCH] fix: selectedGroupIds not being stored in history (#3630) thanks! --- src/element/newElement.ts | 14 +- src/history.ts | 3 +- .../__snapshots__/contextmenu.test.tsx.snap | 62 +++ .../regressionTests.test.tsx.snap | 379 ++++++++++++++---- src/tests/history.test.tsx | 80 +++- src/tests/regressionTests.test.tsx | 16 +- src/tests/selection.test.tsx | 16 +- src/tests/test-utils.ts | 21 + 8 files changed, 478 insertions(+), 113 deletions(-) diff --git a/src/element/newElement.ts b/src/element/newElement.ts index 5cc820ab..ac9da794 100644 --- a/src/element/newElement.ts +++ b/src/element/newElement.ts @@ -307,7 +307,19 @@ export const duplicateElement = >( overrides?: Partial, ): TElement => { let copy: TElement = deepCopyElement(element); - copy.id = process.env.NODE_ENV === "test" ? `${copy.id}_copy` : randomId(); + if (process.env.NODE_ENV === "test") { + copy.id = `${copy.id}_copy`; + // `window.h` may not be defined in some unit tests + if ( + window.h?.app + ?.getSceneElementsIncludingDeleted() + .find((el) => el.id === copy.id) + ) { + copy.id += "_copy"; + } + } else { + copy.id = randomId(); + } copy.seed = randomInteger(); copy.groupIds = getNewGroupIdsForDuplication( copy.groupIds, diff --git a/src/history.ts b/src/history.ts index bbe054d5..cc620cae 100644 --- a/src/history.ts +++ b/src/history.ts @@ -21,6 +21,7 @@ interface DehydratedHistoryEntry { const clearAppStatePropertiesForHistory = (appState: AppState) => { return { selectedElementIds: appState.selectedElementIds, + selectedGroupIds: appState.selectedGroupIds, viewBackgroundColor: appState.viewBackgroundColor, editingLinearElement: appState.editingLinearElement, editingGroupId: appState.editingGroupId, @@ -169,7 +170,7 @@ class History { continue; } } - if (key === "selectedElementIds") { + if (key === "selectedElementIds" || key === "selectedGroupIds") { continue; } if (nextEntry.appState[key] !== lastEntry.appState[key]) { diff --git a/src/tests/__snapshots__/contextmenu.test.tsx.snap b/src/tests/__snapshots__/contextmenu.test.tsx.snap index a02184a3..8cbbc0e4 100644 --- a/src/tests/__snapshots__/contextmenu.test.tsx.snap +++ b/src/tests/__snapshots__/contextmenu.test.tsx.snap @@ -115,6 +115,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -127,6 +128,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -304,6 +306,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -316,6 +319,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -352,6 +356,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -411,6 +416,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -611,6 +617,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -623,6 +630,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -659,6 +667,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -718,6 +727,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -892,6 +902,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -904,6 +915,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1053,6 +1065,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1065,6 +1078,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1099,6 +1113,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1276,6 +1291,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1288,6 +1304,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1324,6 +1341,7 @@ Object { "selectedElementIds": Object { "id0_copy": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1534,6 +1552,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1546,6 +1565,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1582,6 +1602,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1643,6 +1664,9 @@ Object { "id1": true, "id2": true, }, + "selectedGroupIds": Object { + "id3": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1847,6 +1871,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1859,6 +1884,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1895,6 +1921,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1954,6 +1981,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2013,6 +2041,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2072,6 +2101,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2131,6 +2161,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2190,6 +2221,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2249,6 +2281,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2308,6 +2341,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2367,6 +2401,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2567,6 +2602,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2579,6 +2615,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2615,6 +2652,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2674,6 +2712,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2874,6 +2913,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2886,6 +2926,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2922,6 +2963,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2981,6 +3023,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3185,6 +3228,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3197,6 +3241,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3233,6 +3278,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3294,6 +3340,9 @@ Object { "id1": true, "id2": true, }, + "selectedGroupIds": Object { + "id3": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3359,6 +3408,7 @@ Object { "id1": true, "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3565,6 +3615,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3577,6 +3628,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3613,6 +3665,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3825,6 +3878,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3837,6 +3891,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3873,6 +3928,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3935,6 +3991,9 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4085,6 +4144,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4212,6 +4272,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4224,6 +4285,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ diff --git a/src/tests/__snapshots__/regressionTests.test.tsx.snap b/src/tests/__snapshots__/regressionTests.test.tsx.snap index af70532b..43ded173 100644 --- a/src/tests/__snapshots__/regressionTests.test.tsx.snap +++ b/src/tests/__snapshots__/regressionTests.test.tsx.snap @@ -182,6 +182,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -194,6 +195,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -230,6 +232,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -289,6 +292,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -374,6 +378,9 @@ Object { "id3": true, "id4": true, }, + "selectedGroupIds": Object { + "id5": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -649,6 +656,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -661,6 +669,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -697,6 +706,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -756,6 +766,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -840,6 +851,9 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1102,6 +1116,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1114,6 +1129,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1150,6 +1166,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1212,6 +1229,9 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1276,6 +1296,7 @@ Object { "id0": true, "id5": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1339,6 +1360,7 @@ Object { "selectedElementIds": Object { "id7": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1429,6 +1451,9 @@ Object { "id8": true, "id9": true, }, + "selectedGroupIds": Object { + "id10": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1520,6 +1545,7 @@ Object { "id0": true, "id11": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1611,6 +1637,7 @@ Object { "id12": true, "id7": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1819,6 +1846,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -1831,6 +1859,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -1868,6 +1897,7 @@ Object { "id0": true, "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2083,6 +2113,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2095,6 +2126,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2131,6 +2163,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2190,6 +2223,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2275,6 +2309,9 @@ Object { "id3": true, "id4": true, }, + "selectedGroupIds": Object { + "id5": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2505,6 +2542,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2517,6 +2555,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2554,6 +2593,7 @@ Object { "id0": true, "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2728,6 +2768,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2740,6 +2781,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2946,6 +2988,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -2958,6 +3001,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -2994,6 +3038,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3053,6 +3098,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3136,6 +3182,7 @@ Object { "id1": true, "id3": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3333,6 +3380,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3345,6 +3393,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3381,6 +3430,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3417,6 +3467,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3571,6 +3622,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3583,6 +3635,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3620,6 +3673,7 @@ Object { "id0": true, "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3776,6 +3830,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -3788,6 +3843,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3825,6 +3881,7 @@ Object { "id0": true, "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -3863,6 +3920,7 @@ Object { "id1": true, "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4043,6 +4101,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4055,6 +4114,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4091,6 +4151,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4321,6 +4382,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4333,6 +4395,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4369,6 +4432,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4428,6 +4492,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4697,6 +4762,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4709,6 +4775,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4745,6 +4812,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -4969,6 +5037,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -4981,6 +5050,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5017,6 +5087,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5235,6 +5306,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -5247,6 +5319,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5420,6 +5493,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -5432,6 +5506,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5641,6 +5716,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -5653,6 +5729,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5689,6 +5766,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5748,6 +5826,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -5832,6 +5911,9 @@ Object { "id1": true, "id2": true, }, + "selectedGroupIds": Object { + "id3": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6068,6 +6150,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -6080,6 +6163,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6116,6 +6200,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6178,6 +6263,7 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6629,6 +6715,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -6641,6 +6728,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6677,6 +6765,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6736,6 +6825,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6818,6 +6908,7 @@ Object { "selectedElementIds": Object { "id3": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -6938,6 +7029,7 @@ Object { "selectedElementIds": Object { "id4": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -7096,6 +7188,7 @@ Object { "selectedElementIds": Object { "id5": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -7295,6 +7388,7 @@ Object { "selectedElementIds": Object { "id5": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -7498,6 +7592,7 @@ Object { "selectedElementIds": Object { "id6": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -7742,6 +7837,7 @@ Object { "selectedElementIds": Object { "id6": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -7990,6 +8086,7 @@ Object { "selectedElementIds": Object { "id7": false, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -8454,6 +8551,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -8466,6 +8564,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -8502,6 +8601,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -8561,6 +8661,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -8790,6 +8891,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -8800,6 +8902,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -8836,6 +8939,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9040,6 +9144,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -9053,6 +9158,7 @@ Object { "id0": true, "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9258,6 +9364,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -9271,6 +9378,7 @@ Object { "id0": true, "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9332,6 +9440,7 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9506,6 +9615,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -9518,6 +9628,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9669,6 +9780,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -9681,6 +9793,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -9832,6 +9945,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -9844,6 +9958,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10010,6 +10125,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10022,6 +10138,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10203,6 +10320,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10215,6 +10333,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10402,6 +10521,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10414,6 +10534,7 @@ Object { "selectedElementIds": Object { "id0": false, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10601,6 +10722,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10613,6 +10735,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10779,6 +10902,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10791,6 +10915,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -10942,6 +11067,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -10954,6 +11080,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11120,6 +11247,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -11132,6 +11260,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11298,6 +11427,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -11310,6 +11440,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11482,6 +11613,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -11494,6 +11626,7 @@ Object { "selectedElementIds": Object { "id0": false, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11819,6 +11952,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -11831,6 +11965,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11867,6 +12002,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -11926,6 +12062,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -12011,6 +12148,9 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -12103,6 +12243,9 @@ Object { "id3": true, "id5": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -12411,6 +12554,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -12423,6 +12567,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -12459,6 +12604,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -12607,6 +12753,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -12706,6 +12853,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -12836,6 +12984,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -12848,6 +12997,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13034,6 +13184,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -13046,6 +13197,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13082,6 +13234,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13145,6 +13298,7 @@ Object { "id3": true, "id4": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13319,6 +13473,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -13331,6 +13486,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13367,6 +13523,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13619,6 +13776,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -13631,6 +13789,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13667,6 +13826,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13729,6 +13889,9 @@ Object { "id2": true, "id3": true, }, + "selectedGroupIds": Object { + "id4": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13792,6 +13955,7 @@ Object { "selectedElementIds": Object { "id5": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13878,6 +14042,7 @@ Object { "selectedElementIds": Object { "id6": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -13990,6 +14155,9 @@ Object { "id7": true, "id8": true, }, + "selectedGroupIds": Object { + "id9": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14106,6 +14274,9 @@ Object { "id5": true, "id6": true, }, + "selectedGroupIds": Object { + "id10": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14310,6 +14481,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -14499,6 +14671,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -14511,6 +14684,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14547,6 +14721,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14606,6 +14781,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14690,95 +14866,8 @@ Object { "id1": true, "id2": true, }, - "viewBackgroundColor": "#ffffff", - }, - "elements": Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElementIds": null, - "fillStyle": "hachure", - "groupIds": Array [ - "id3", - ], - "height": 50, - "id": "id0", - "isDeleted": false, - "opacity": 100, - "roughness": 1, - "seed": 337897, - "strokeColor": "#000000", - "strokeSharpness": "sharp", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "version": 3, - "versionNonce": 1150084233, - "width": 50, - "x": 0, - "y": 0, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElementIds": null, - "fillStyle": "hachure", - "groupIds": Array [ - "id3", - ], - "height": 50, - "id": "id1", - "isDeleted": false, - "opacity": 100, - "roughness": 1, - "seed": 449462985, - "strokeColor": "#000000", - "strokeSharpness": "sharp", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "version": 3, - "versionNonce": 1116226695, - "width": 50, - "x": 100, - "y": 100, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElementIds": null, - "fillStyle": "hachure", - "groupIds": Array [ - "id3", - ], - "height": 50, - "id": "id2", - "isDeleted": false, - "opacity": 100, - "roughness": 1, - "seed": 401146281, - "strokeColor": "#000000", - "strokeSharpness": "sharp", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "version": 3, - "versionNonce": 1014066025, - "width": 50, - "x": 200, - "y": 200, - }, - ], - }, - Object { - "appState": Object { - "editingGroupId": "id3", - "editingLinearElement": null, - "name": "Untitled-201933152653", - "selectedElementIds": Object { - "id0": true, - "id2": true, - "id4": true, + "selectedGroupIds": Object { + "id3": true, }, "viewBackgroundColor": "#ffffff", }, @@ -14870,6 +14959,100 @@ Object { "id2": true, "id4": true, }, + "selectedGroupIds": Object {}, + "viewBackgroundColor": "#ffffff", + }, + "elements": Array [ + Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElementIds": null, + "fillStyle": "hachure", + "groupIds": Array [ + "id3", + ], + "height": 50, + "id": "id0", + "isDeleted": false, + "opacity": 100, + "roughness": 1, + "seed": 337897, + "strokeColor": "#000000", + "strokeSharpness": "sharp", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "version": 3, + "versionNonce": 1150084233, + "width": 50, + "x": 0, + "y": 0, + }, + Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElementIds": null, + "fillStyle": "hachure", + "groupIds": Array [ + "id3", + ], + "height": 50, + "id": "id1", + "isDeleted": false, + "opacity": 100, + "roughness": 1, + "seed": 449462985, + "strokeColor": "#000000", + "strokeSharpness": "sharp", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "version": 3, + "versionNonce": 1116226695, + "width": 50, + "x": 100, + "y": 100, + }, + Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElementIds": null, + "fillStyle": "hachure", + "groupIds": Array [ + "id3", + ], + "height": 50, + "id": "id2", + "isDeleted": false, + "opacity": 100, + "roughness": 1, + "seed": 401146281, + "strokeColor": "#000000", + "strokeSharpness": "sharp", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "version": 3, + "versionNonce": 1014066025, + "width": 50, + "x": 200, + "y": 200, + }, + ], + }, + Object { + "appState": Object { + "editingGroupId": "id3", + "editingLinearElement": null, + "name": "Untitled-201933152653", + "selectedElementIds": Object { + "id0": true, + "id2": true, + "id4": true, + }, + "selectedGroupIds": Object { + "id5": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -14963,6 +15146,9 @@ Object { "id2": true, "id7": true, }, + "selectedGroupIds": Object { + "id3": true, + }, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15268,6 +15454,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -15280,6 +15467,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15316,6 +15504,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15375,6 +15564,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15644,6 +15834,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -15656,6 +15847,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15692,6 +15884,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -15840,6 +16033,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -16038,6 +16232,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -16142,6 +16337,7 @@ Object { "selectedElementIds": Object { "id2": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -16242,6 +16438,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -16254,6 +16451,7 @@ Object { "selectedElementIds": Object { "id0": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -16290,6 +16488,7 @@ Object { "selectedElementIds": Object { "id1": true, }, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [ @@ -16436,6 +16635,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], @@ -16535,6 +16735,7 @@ Object { "editingLinearElement": null, "name": "Untitled-201933152653", "selectedElementIds": Object {}, + "selectedGroupIds": Object {}, "viewBackgroundColor": "#ffffff", }, "elements": Array [], diff --git a/src/tests/history.test.tsx b/src/tests/history.test.tsx index aeadaa94..792b2a10 100644 --- a/src/tests/history.test.tsx +++ b/src/tests/history.test.tsx @@ -1,7 +1,7 @@ import React from "react"; -import { render } from "./test-utils"; +import { assertSelectedElements, render } from "./test-utils"; import ExcalidrawApp from "../excalidraw-app"; -import { UI } from "./helpers/ui"; +import { Keyboard, Pointer, UI } from "./helpers/ui"; import { API } from "./helpers/api"; import { getDefaultAppState } from "../appState"; import { waitFor } from "@testing-library/react"; @@ -10,6 +10,8 @@ import { EXPORT_DATA_TYPES } from "../constants"; const { h } = window; +const mouse = new Pointer("mouse"); + describe("history", () => { it("initializing scene should end up with single history entry", async () => { await render(, { @@ -110,4 +112,78 @@ describe("history", () => { expect.objectContaining({ id: "A", isDeleted: true }), ]); }); + + it("undo/redo works properly with groups", async () => { + await render(); + const rect1 = API.createElement({ type: "rectangle", groupIds: ["A"] }); + const rect2 = API.createElement({ type: "rectangle", groupIds: ["A"] }); + + h.elements = [rect1, rect2]; + mouse.select(rect1); + assertSelectedElements([rect1, rect2]); + expect(h.state.selectedGroupIds).toEqual({ A: true }); + + Keyboard.withModifierKeys({ ctrl: true }, () => { + Keyboard.keyPress("d"); + }); + expect(h.elements.length).toBe(4); + assertSelectedElements([h.elements[2], h.elements[3]]); + expect(h.state.selectedGroupIds).not.toEqual( + expect.objectContaining({ A: true }), + ); + + Keyboard.withModifierKeys({ ctrl: true }, () => { + Keyboard.keyPress("z"); + }); + expect(h.elements.length).toBe(4); + expect(h.elements).toEqual([ + expect.objectContaining({ id: rect1.id, isDeleted: false }), + expect.objectContaining({ id: rect2.id, isDeleted: false }), + expect.objectContaining({ id: `${rect1.id}_copy`, isDeleted: true }), + expect.objectContaining({ id: `${rect2.id}_copy`, isDeleted: true }), + ]); + expect(h.state.selectedGroupIds).toEqual({ A: true }); + + Keyboard.withModifierKeys({ ctrl: true, shift: true }, () => { + Keyboard.keyPress("z"); + }); + expect(h.elements.length).toBe(4); + expect(h.elements).toEqual([ + expect.objectContaining({ id: rect1.id, isDeleted: false }), + expect.objectContaining({ id: rect2.id, isDeleted: false }), + expect.objectContaining({ id: `${rect1.id}_copy`, isDeleted: false }), + expect.objectContaining({ id: `${rect2.id}_copy`, isDeleted: false }), + ]); + expect(h.state.selectedGroupIds).not.toEqual( + expect.objectContaining({ A: true }), + ); + + // undo again, and duplicate once more + // ------------------------------------------------------------------------- + + Keyboard.withModifierKeys({ ctrl: true }, () => { + Keyboard.keyPress("z"); + Keyboard.keyPress("d"); + }); + expect(h.elements.length).toBe(6); + expect(h.elements).toEqual( + expect.arrayContaining([ + expect.objectContaining({ id: rect1.id, isDeleted: false }), + expect.objectContaining({ id: rect2.id, isDeleted: false }), + expect.objectContaining({ id: `${rect1.id}_copy`, isDeleted: true }), + expect.objectContaining({ id: `${rect2.id}_copy`, isDeleted: true }), + expect.objectContaining({ + id: `${rect1.id}_copy_copy`, + isDeleted: false, + }), + expect.objectContaining({ + id: `${rect2.id}_copy_copy`, + isDeleted: false, + }), + ]), + ); + expect(h.state.selectedGroupIds).not.toEqual( + expect.objectContaining({ A: true }), + ); + }); }); diff --git a/src/tests/regressionTests.test.tsx b/src/tests/regressionTests.test.tsx index b35293d1..fbfeb393 100644 --- a/src/tests/regressionTests.test.tsx +++ b/src/tests/regressionTests.test.tsx @@ -7,21 +7,19 @@ import * as Renderer from "../renderer/renderScene"; import { setDateTimeForTests } from "../utils"; import { API } from "./helpers/api"; import { Keyboard, Pointer, UI } from "./helpers/ui"; -import { fireEvent, render, screen, waitFor } from "./test-utils"; +import { + assertSelectedElements, + fireEvent, + render, + screen, + waitFor, +} from "./test-utils"; import { defaultLang } from "../i18n"; const { h } = window; const renderScene = jest.spyOn(Renderer, "renderScene"); -const assertSelectedElements = (...elements: ExcalidrawElement[]) => { - expect( - API.getSelectedElements().map((element) => { - return element.id; - }), - ).toEqual(expect.arrayContaining(elements.map((element) => element.id))); -}; - const mouse = new Pointer("mouse"); const finger1 = new Pointer("touch", 1); const finger2 = new Pointer("touch", 2); diff --git a/src/tests/selection.test.tsx b/src/tests/selection.test.tsx index 3d92cfd0..ec640e68 100644 --- a/src/tests/selection.test.tsx +++ b/src/tests/selection.test.tsx @@ -5,6 +5,7 @@ import { fireEvent, mockBoundingClientRect, restoreOriginalGetBoundingClientRect, + assertSelectedElements, } from "./test-utils"; import ExcalidrawApp from "../excalidraw-app"; import * as Renderer from "../renderer/renderScene"; @@ -12,7 +13,6 @@ import { KEYS } from "../keys"; import { reseed } from "../random"; import { API } from "./helpers/api"; import { Keyboard, Pointer } from "./helpers/ui"; -import { getSelectedElements } from "../scene"; // Unmount ReactDOM from root ReactDOM.unmountComponentAtNode(document.getElementById("root")!); @@ -28,12 +28,6 @@ const { h } = window; const mouse = new Pointer("mouse"); -const assertSelectedIds = (ids: string[]) => { - expect( - getSelectedElements(h.app.getSceneElements(), h.state).map((el) => el.id), - ).toEqual(ids); -}; - describe("inner box-selection", () => { beforeEach(async () => { await render(); @@ -68,7 +62,7 @@ describe("inner box-selection", () => { mouse.moveTo(290, 290); mouse.up(); - assertSelectedIds([rect2.id, rect3.id]); + assertSelectedElements([rect2.id, rect3.id]); }); }); @@ -105,7 +99,7 @@ describe("inner box-selection", () => { mouse.moveTo(rect2.x + rect2.width + 10, rect2.y + rect2.height + 10); mouse.up(); - assertSelectedIds([rect2.id, rect3.id]); + assertSelectedElements([rect2.id, rect3.id]); expect(h.state.selectedGroupIds).toEqual({ A: true }); }); }); @@ -140,10 +134,10 @@ describe("inner box-selection", () => { Keyboard.withModifierKeys({ ctrl: true }, () => { mouse.downAt(rect2.x - 20, rect2.x - 20); mouse.moveTo(rect2.x + rect2.width + 10, rect2.y + rect2.height + 10); - assertSelectedIds([rect2.id, rect3.id]); + assertSelectedElements([rect2.id, rect3.id]); expect(h.state.selectedGroupIds).toEqual({ A: true }); mouse.moveTo(rect2.x - 10, rect2.y - 10); - assertSelectedIds([rect1.id]); + assertSelectedElements([rect1.id]); expect(h.state.selectedGroupIds).toEqual({}); mouse.up(); }); diff --git a/src/tests/test-utils.ts b/src/tests/test-utils.ts index dfe243bb..98f387f3 100644 --- a/src/tests/test-utils.ts +++ b/src/tests/test-utils.ts @@ -13,6 +13,8 @@ import { ImportedDataState } from "../data/types"; import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; import { SceneData } from "../types"; +import { getSelectedElements } from "../scene/selection"; +import { ExcalidrawElement } from "../element/types"; const customQueries = { ...queries, @@ -124,3 +126,22 @@ export const mockBoundingClientRect = () => { export const restoreOriginalGetBoundingClientRect = () => { global.window.HTMLDivElement.prototype.getBoundingClientRect = originalGetBoundingClientRect; }; + +export const assertSelectedElements = ( + ...elements: ( + | (ExcalidrawElement["id"] | ExcalidrawElement)[] + | ExcalidrawElement["id"] + | ExcalidrawElement + )[] +) => { + const { h } = window; + const selectedElementIds = getSelectedElements( + h.app.getSceneElements(), + h.state, + ).map((el) => el.id); + const ids = elements + .flat() + .map((item) => (typeof item === "string" ? item : item.id)); + expect(selectedElementIds.length).toBe(ids.length); + expect(selectedElementIds).toEqual(expect.arrayContaining(ids)); +};