Virtual whiteboard for sketching hand-drawn like diagrams
chore: Remove startBoundElement from state (#11264)
Márk Tolmács2dfcc6f0ce4c
diff --git a/packages/excalidraw/actions/actionFinalize.tsx b/packages/excalidraw/actions/actionFinalize.tsxindex 37332c4124..c52bbe00a4 100644--- a/packages/excalidraw/actions/actionFinalize.tsx+++ b/packages/excalidraw/actions/actionFinalize.tsx@@ -329,7 +329,6 @@ export const actionFinalize = register<FormData>({selectionElement: null,multiElement: null,editingTextElement: null,- startBoundElement: null,suggestedBinding: null,selectedElementIds:element &&diff --git a/packages/excalidraw/appState.ts b/packages/excalidraw/appState.tsindex 93fe770286..a64eed8ca7 100644--- a/packages/excalidraw/appState.ts+++ b/packages/excalidraw/appState.ts@@ -99,7 +99,6 @@ export const getDefaultAppState = (): Omit<open: false,panels: STATS_PANELS.generalStats | STATS_PANELS.elementProperties,},- startBoundElement: null,suggestedBinding: null,frameRendering: { enabled: true, clip: true, name: true, outline: true },frameToHighlight: null,@@ -231,7 +230,6 @@ const APP_STATE_STORAGE_CONF = (<selectionElement: { browser: false, export: false, server: false },shouldCacheIgnoreZoom: { browser: true, export: false, server: false },stats: { browser: true, export: false, server: false },- startBoundElement: { browser: false, export: false, server: false },suggestedBinding: { browser: false, export: false, server: false },frameRendering: { browser: false, export: false, server: false },frameToHighlight: { browser: false, export: false, server: false },diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsxindex 299304eb0e..3fd81e2ac7 100644--- a/packages/excalidraw/components/App.tsx+++ b/packages/excalidraw/components/App.tsx@@ -6947,7 +6947,7 @@ class App extends React.Component<AppProps, AppState> {y: scenePointerY,},});- this.setState({ suggestedBinding: null, startBoundElement: null });+ this.setState({ suggestedBinding: null });if (!this.state.activeTool.locked) {resetCursor(this.interactiveCanvas);this.setState((prevState) => ({@@ -7591,7 +7591,6 @@ class App extends React.Component<AppProps, AppState> {appState: {newElement: null,editingTextElement: null,- startBoundElement: null,suggestedBinding: null,selectedElementIds: makeNextSelectedElementIds(Object.keys(this.state.selectedElementIds)@@ -8879,18 +8878,8 @@ class App extends React.Component<AppProps, AppState> {};});- const boundElement = getHoveredElementForBinding(- pointFrom<GlobalPoint>(- pointerDownState.origin.x,- pointerDownState.origin.y,- ),- this.scene.getNonDeletedElements(),- this.scene.getNonDeletedElementsMap(),- );-this.setState({newElement: element,- startBoundElement: boundElement,suggestedBinding: null,});};@@ -10743,7 +10732,7 @@ class App extends React.Component<AppProps, AppState> {sceneCoords,});}- this.setState({ suggestedBinding: null, startBoundElement: null });+ this.setState({ suggestedBinding: null });if (!activeTool.locked) {resetCursor(this.interactiveCanvas);this.setState((prevState) => ({@@ -10764,9 +10753,9 @@ class App extends React.Component<AppProps, AppState> {),}));} else {- this.setState((prevState) => ({+ this.setState({newElement: null,- }));+ });}// so that the scene gets rendered again to display the newly drawn linear as wellthis.scene.triggerUpdate();diff --git a/packages/excalidraw/components/LayerUI.tsx b/packages/excalidraw/components/LayerUI.tsxindex bf774bfebc..b653722147 100644--- a/packages/excalidraw/components/LayerUI.tsx+++ b/packages/excalidraw/components/LayerUI.tsx@@ -650,8 +650,7 @@ const LayerUI = ({};const stripIrrelevantAppStateProps = (appState: AppState): UIAppState => {- const { startBoundElement, cursorButton, scrollX, scrollY, ...ret } =- appState;+ const { cursorButton, scrollX, scrollY, ...ret } = appState;return ret;};diff --git a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snapindex cb548f5b62..7162ed5f91 100644--- a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap+++ b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap@@ -979,7 +979,6 @@ exports[`contextMenu element > right-clicking on a group should select whole gro"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1173,7 +1172,6 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1388,7 +1386,6 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1720,7 +1717,6 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2052,7 +2048,6 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2265,7 +2260,6 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2509,7 +2503,6 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2813,7 +2806,6 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3181,7 +3173,6 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3675,7 +3666,6 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3999,7 +3989,6 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4326,7 +4315,6 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5612,7 +5600,6 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -6832,7 +6819,6 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7786,7 +7772,6 @@ exports[`contextMenu element > shows context menu for canvas > [end of test] app"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8786,7 +8771,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9781,7 +9765,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snapindex 2923e9b321..fd57911e3e 100644--- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap+++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap@@ -1293,7 +1293,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1654,7 +1653,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2017,7 +2015,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2280,7 +2277,40 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,+ "startBoundElement": {+ "angle": 0,+ "backgroundColor": "transparent",+ "boundElements": [+ {+ "id": "id4",+ "type": "arrow",+ },+ ],+ "customData": undefined,+ "fillStyle": "solid",+ "frameId": null,+ "groupIds": [],+ "height": 100,+ "id": "id0",+ "index": "a0",+ "isDeleted": false,+ "link": null,+ "locked": false,+ "opacity": 100,+ "roughness": 1,+ "roundness": null,+ "seed": 1,+ "strokeColor": "#1e1e1e",+ "strokeStyle": "solid",+ "strokeWidth": 2,+ "type": "rectangle",+ "updated": 1,+ "version": 3,+ "versionNonce": 493213705,+ "width": 100,+ "x": -100,+ "y": -50,+ },"stats": {"open": false,"panels": 3,@@ -2735,7 +2765,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3039,7 +3068,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3359,7 +3387,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3654,7 +3681,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3941,7 +3967,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4177,7 +4202,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4435,7 +4459,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4707,7 +4730,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4937,7 +4959,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5167,7 +5188,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5415,7 +5435,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5672,7 +5691,6 @@ exports[`history > multiplayer undo/redo > conflicts in frames and their childre"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5930,7 +5948,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -6260,7 +6277,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -6691,7 +6707,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7072,7 +7087,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7667,7 +7681,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7898,7 +7911,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8251,7 +8263,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8610,7 +8621,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9011,7 +9021,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9293,7 +9302,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9558,7 +9566,6 @@ exports[`history > multiplayer undo/redo > should not override remote changes on"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9824,7 +9831,6 @@ exports[`history > multiplayer undo/redo > should not override remote changes on"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10058,7 +10064,6 @@ exports[`history > multiplayer undo/redo > should override remotely added groups"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10671,7 +10676,6 @@ exports[`history > multiplayer undo/redo > should redistribute deltas when eleme"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10911,7 +10915,6 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -11836,7 +11839,6 @@ exports[`history > multiplayer undo/redo > should update history entries after r"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12095,7 +12097,6 @@ exports[`history > singleplayer undo/redo > remounting undo/redo buttons should"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12333,7 +12334,6 @@ exports[`history > singleplayer undo/redo > should clear the redo stack on eleme"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12569,7 +12569,6 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12966,7 +12965,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on e"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13174,7 +13172,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on e"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13386,7 +13383,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on i"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13685,7 +13681,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on i"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13984,7 +13979,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on s"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14229,7 +14223,6 @@ exports[`history > singleplayer undo/redo > should disable undo/redo buttons whe"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14467,7 +14460,6 @@ exports[`history > singleplayer undo/redo > should end up with no history entry"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14705,7 +14697,6 @@ exports[`history > singleplayer undo/redo > should iterate through the history w"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14953,7 +14944,6 @@ exports[`history > singleplayer undo/redo > should not clear the redo stack on s"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -15286,7 +15276,6 @@ exports[`history > singleplayer undo/redo > should not collapse when applying co"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -15459,7 +15448,6 @@ exports[`history > singleplayer undo/redo > should not end up with history entry"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -15742,7 +15730,6 @@ exports[`history > singleplayer undo/redo > should not end up with history entry"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -16006,7 +15993,6 @@ exports[`history > singleplayer undo/redo > should not modify anything on unrela"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -16161,7 +16147,6 @@ exports[`history > singleplayer undo/redo > should not override appstate changes"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -16443,7 +16428,6 @@ exports[`history > singleplayer undo/redo > should support appstate name or view"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -20170,7 +20154,6 @@ exports[`history > singleplayer undo/redo > should support changes in elements'"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -20653,7 +20636,6 @@ exports[`history > singleplayer undo/redo > should support duplication of groups"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -21160,7 +21142,6 @@ exports[`history > singleplayer undo/redo > should support element creation, del"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,diff --git a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snapindex e502925b25..3f836165fc 100644--- a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap+++ b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap@@ -106,7 +106,6 @@ exports[`given element A and group of elements B and given both are selected whe"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -535,7 +534,6 @@ exports[`given element A and group of elements B and given both are selected whe"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -943,7 +941,6 @@ exports[`regression tests > Cmd/Ctrl-click exclusively select element under poin"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1510,7 +1507,6 @@ exports[`regression tests > Drags selected element when hitting only bounding bo"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -1723,7 +1719,6 @@ exports[`regression tests > adjusts z order when grouping > [end of test] appSta"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2105,7 +2100,6 @@ exports[`regression tests > alt-drag duplicates an element > [end of test] appSt"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2349,7 +2343,6 @@ exports[`regression tests > arrow keys > [end of test] appState 1`] = `"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2532,7 +2525,6 @@ exports[`regression tests > can drag element that covers another element, while"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -2856,7 +2848,6 @@ exports[`regression tests > change the properties of a shape > [end of test] app"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3114,7 +3105,6 @@ exports[`regression tests > click on an element and drag it > [dragged] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3356,7 +3346,6 @@ exports[`regression tests > click on an element and drag it > [end of test] appS"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3593,7 +3582,6 @@ exports[`regression tests > click to select a shape > [end of test] appState 1`]"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -3853,7 +3841,6 @@ exports[`regression tests > click-drag to select a group > [end of test] appStat"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4167,7 +4154,6 @@ exports[`regression tests > deleting last but one element in editing group shoul"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4631,7 +4617,6 @@ exports[`regression tests > deselects group of selected elements on pointer down"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -4887,7 +4872,6 @@ exports[`regression tests > deselects group of selected elements on pointer up w"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5191,7 +5175,6 @@ exports[`regression tests > deselects selected element on pointer down when poin"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5372,7 +5355,6 @@ exports[`regression tests > deselects selected element, on pointer up, when clic"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5573,7 +5555,6 @@ exports[`regression tests > double click to edit a group > [end of test] appStat"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -5971,7 +5952,6 @@ exports[`regression tests > drags selected elements from point inside common bou"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7057,7 +7037,6 @@ exports[`regression tests > given a group of selected elements with an element t"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7392,7 +7371,6 @@ exports[`regression tests > given a selected element A and a not selected elemen"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7671,7 +7649,6 @@ exports[`regression tests > given selected element A with lower z-index than uns"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -7907,7 +7884,6 @@ exports[`regression tests > given selected element A with lower z-index than uns"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8146,7 +8122,6 @@ exports[`regression tests > key 2 selects rectangle tool > [end of test] appStat"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8327,7 +8302,6 @@ exports[`regression tests > key 3 selects diamond tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -8508,7 +8482,6 @@ exports[`regression tests > key 4 selects ellipse tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9151,7 +9124,6 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9579,7 +9551,6 @@ exports[`regression tests > key d selects diamond tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -9991,7 +9962,6 @@ exports[`regression tests > key o selects ellipse tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10170,7 +10140,6 @@ exports[`regression tests > key p selects freedraw tool > [end of test] appState"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10365,7 +10334,6 @@ exports[`regression tests > key r selects rectangle tool > [end of test] appStat"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -10554,7 +10522,6 @@ exports[`regression tests > make a group and duplicate it > [end of test] appSta"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -11080,7 +11047,6 @@ exports[`regression tests > noop interaction after undo shouldn't create history"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -11357,7 +11323,6 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = `"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -11483,7 +11448,6 @@ exports[`regression tests > shift click on selected element should deselect it o"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -11688,7 +11652,6 @@ exports[`regression tests > shift-click to multiselect, then drag > [end of test"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12010,7 +11973,6 @@ exports[`regression tests > should group elements and ungroup them > [end of tes"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -12444,7 +12406,6 @@ exports[`regression tests > single-clicking on a subgroup of a selected group sh"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13076,7 +13037,6 @@ exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] a"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13204,7 +13164,6 @@ exports[`regression tests > supports nested groups > [end of test] appState 1`]"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -13865,7 +13824,6 @@ exports[`regression tests > switches from group of selected elements to another"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14204,7 +14162,6 @@ exports[`regression tests > switches selected element on pointer down > [end of"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14437,7 +14394,6 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`]"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -14926,7 +14882,6 @@ exports[`regression tests > updates fontSize & fontFamily appState > [end of tes"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,@@ -15053,7 +15008,6 @@ exports[`regression tests > zoom hotkeys > [end of test] appState 1`] = `"showHyperlinkPopup": false,"showWelcomeScreen": true,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.tsindex a41512fe64..c4fb15243b 100644--- a/packages/excalidraw/types.ts+++ b/packages/excalidraw/types.ts@@ -315,7 +315,10 @@ export interface AppState {bindingPreference: "enabled" | "disabled";/** user preference whether arrow snap to midpoints while binding */isMidpointSnappingEnabled: boolean;- startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;+ /**+ * The bindable element the UI highlights for the user when an arrow is+ * dragged or otherwise its endpoint being close to said element.+ */suggestedBinding: {element: NonDeleted<ExcalidrawBindableElement>;midPoint?: GlobalPoint;@@ -347,8 +350,11 @@ export interface AppState {type: "selection" | "lasso";initialized: boolean;};++ // Pen handlingpenMode: boolean;penDetected: boolean;+exportBackground: boolean;exportEmbedScene: boolean;exportWithDarkMode: boolean;@@ -472,6 +478,9 @@ export interface AppState {// as elements are unlocked, we remove the groupId from the elements// and also remove groupId from this maplockedMultiSelections: { [groupId: string]: true };+ // Stores the current bind mode which is detemined at various points during+ // a drag operation (like pointer position vs bindable element) but needed+ // globally for calculating the binding strategybindMode: BindMode;}@@ -487,10 +496,7 @@ export type SearchMatch = {}[];};-export type UIAppState = Omit<- AppState,- "startBoundElement" | "cursorButton" | "scrollX" | "scrollY"->;+export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY">;export type NormalizedZoomValue = number & { _brand: "normalizedZoom" };@@ -870,8 +876,13 @@ export type PointerDownState = Readonly<{// Whether selected element(s) were duplicated, might change during the// pointer interactionhasBeenDuplicated: boolean;+ // Whether the pointer is hitting the common bounding box of selected+ // elements, which is useful for discriminating between selecitng+ // the entire selection vs a specific elementhasHitCommonBoundingBoxOfSelectedElements: boolean;};+ // This is determined on the initial pointer down event to+ // set various interaction modalitieswithCmdOrCtrl: boolean;drag: {// Might change during the pointer interaction@@ -897,6 +908,7 @@ export type PointerDownState = Readonly<{onKeyUp: null | ((event: KeyboardEvent) => void);};boxSelection: {+ // If the box selection tool is activated on pointer downhasOccurred: boolean;};}>;diff --git a/packages/utils/tests/__snapshots__/export.test.ts.snap b/packages/utils/tests/__snapshots__/export.test.ts.snapindex f59d0a9e84..67c2273766 100644--- a/packages/utils/tests/__snapshots__/export.test.ts.snap+++ b/packages/utils/tests/__snapshots__/export.test.ts.snap@@ -98,7 +98,6 @@ exports[`exportToSvg > with default arguments 1`] = `"showHyperlinkPopup": false,"showWelcomeScreen": false,"snapLines": [],- "startBoundElement": null,"stats": {"open": false,"panels": 3,