@ -11,6 +11,18 @@ The change should be grouped under one of the below section and must contain PR
Please add the latest change on the top under the correct section.
Please add the latest change on the top under the correct section.
-->
-->
## Unreleased
### Excalidraw API
#### Refactor
- Rename `appState.elementType` to [`appState.activeTool`](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L80) which is now an object.
##### BREAKING CHANGE
You will need to pass `activeTool` instead of `elementType` from now onwards in `appState`
exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected: [end of test] appState 1`] = `
exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -24,7 +27,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -495,6 +497,9 @@ exports[`given element A and group of elements B and given both are selected whe
exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected: [end of test] appState 1`] = `
exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -517,7 +522,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -994,6 +998,9 @@ exports[`given element A and group of elements B and given both are selected whe
exports[`regression tests Cmd/Ctrl-click exclusively select element under pointer: [end of test] appState 1`] = `
exports[`regression tests Cmd/Ctrl-click exclusively select element under pointer: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -1016,7 +1023,6 @@ Object {
"editingGroupId": "id10",
"editingGroupId": "id10",
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -1828,6 +1834,9 @@ exports[`regression tests Cmd/Ctrl-click exclusively select element under pointe
exports[`regression tests Drags selected element when hitting only bounding box and keeps element selected: [end of test] appState 1`] = `
exports[`regression tests Drags selected element when hitting only bounding box and keeps element selected: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -1850,7 +1859,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -2042,6 +2050,9 @@ exports[`regression tests Drags selected element when hitting only bounding box
exports[`regression tests adjusts z order when grouping: [end of test] appState 1`] = `
exports[`regression tests adjusts z order when grouping: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -2064,7 +2075,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -2532,6 +2542,9 @@ exports[`regression tests adjusts z order when grouping: [end of test] number of
exports[`regression tests alt-drag duplicates an element: [end of test] appState 1`] = `
exports[`regression tests alt-drag duplicates an element: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -2554,7 +2567,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -2799,6 +2811,9 @@ exports[`regression tests alt-drag duplicates an element: [end of test] number o
@ -2970,6 +2984,9 @@ exports[`regression tests arrow keys: [end of test] number of renders 1`] = `20`
exports[`regression tests can drag element that covers another element, while another elem is selected: [end of test] appState 1`] = `
exports[`regression tests can drag element that covers another element, while another elem is selected: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -2992,7 +3009,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -3443,6 +3459,9 @@ exports[`regression tests can drag element that covers another element, while an
exports[`regression tests change the properties of a shape: [end of test] appState 1`] = `
exports[`regression tests change the properties of a shape: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252",
"currentItemBackgroundColor": "#fa5252",
@ -3465,7 +3484,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -3692,6 +3710,9 @@ exports[`regression tests change the properties of a shape: [end of test] number
exports[`regression tests click on an element and drag it: [dragged] appState 1`] = `
exports[`regression tests click on an element and drag it: [dragged] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -3714,7 +3735,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -3906,6 +3926,9 @@ exports[`regression tests click on an element and drag it: [dragged] number of r
exports[`regression tests click on an element and drag it: [end of test] appState 1`] = `
exports[`regression tests click on an element and drag it: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -3928,7 +3951,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -4163,6 +4185,9 @@ exports[`regression tests click on an element and drag it: [end of test] number
exports[`regression tests click to select a shape: [end of test] appState 1`] = `
exports[`regression tests click to select a shape: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -4185,7 +4210,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -4429,6 +4453,9 @@ exports[`regression tests click to select a shape: [end of test] number of rende
exports[`regression tests click-drag to select a group: [end of test] appState 1`] = `
exports[`regression tests click-drag to select a group: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -4451,7 +4478,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -4813,6 +4839,9 @@ exports[`regression tests click-drag to select a group: [end of test] number of
exports[`regression tests deselects group of selected elements on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
exports[`regression tests deselects group of selected elements on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -4859,7 +4888,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -5126,6 +5154,9 @@ exports[`regression tests deselects group of selected elements on pointer down w
exports[`regression tests deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element: [end of test] appState 1`] = `
exports[`regression tests deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -5172,7 +5203,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -5415,6 +5445,9 @@ exports[`regression tests deselects group of selected elements on pointer up whe
exports[`regression tests deselects selected element on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
exports[`regression tests deselects selected element on pointer down when pointer doesn't hit any element: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -5461,7 +5494,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -5634,6 +5666,9 @@ exports[`regression tests deselects selected element on pointer down when pointe
exports[`regression tests deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element: [end of test] appState 1`] = `
exports[`regression tests deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -5680,7 +5715,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -5829,6 +5863,9 @@ exports[`regression tests deselects selected element, on pointer up, when click
exports[`regression tests double click to edit a group: [end of test] appState 1`] = `
exports[`regression tests double click to edit a group: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -5851,7 +5888,6 @@ Object {
"editingGroupId": "id3",
"editingGroupId": "id3",
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -6314,6 +6350,9 @@ exports[`regression tests double click to edit a group: [end of test] number of
exports[`regression tests drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging: [end of test] appState 1`] = `
exports[`regression tests drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -6336,7 +6375,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -6651,6 +6689,9 @@ exports[`regression tests drags selected elements from point inside common bound
exports[`regression tests draw every type of shape: [end of test] appState 1`] = `
exports[`regression tests draw every type of shape: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "freedraw",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -6673,7 +6714,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "freedraw",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -8829,6 +8869,9 @@ exports[`regression tests draw every type of shape: [end of test] number of rend
exports[`regression tests given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up: [end of test] appState 1`] = `
exports[`regression tests given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -8851,7 +8894,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -9214,6 +9256,9 @@ exports[`regression tests given a group of selected elements with an element tha
exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] appState 1`] = `
exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "#fa5252",
"currentItemBackgroundColor": "#fa5252",
@ -9236,7 +9281,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -9481,6 +9525,9 @@ exports[`regression tests given a selected element A and a not selected element
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = `
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -9503,7 +9550,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -9710,6 +9756,9 @@ exports[`regression tests given selected element A with lower z-index than unsel
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = `
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = `
Object {
Object {
"activeTool": Object {
"type": "selection",
},
"collaborators": Map {},
"collaborators": Map {},
"currentChartType": "bar",
"currentChartType": "bar",
"currentItemBackgroundColor": "transparent",
"currentItemBackgroundColor": "transparent",
@ -9732,7 +9781,6 @@ Object {
"editingGroupId": null,
"editingGroupId": null,
"editingLinearElement": null,
"editingLinearElement": null,
"elementLocked": false,
"elementLocked": false,
"elementType": "selection",
"errorMessage": null,
"errorMessage": null,
"exportBackground": true,
"exportBackground": true,
"exportEmbedScene": false,
"exportEmbedScene": false,
@ -10006,6 +10054,9 @@ exports[`regression tests given selected element A with lower z-index than unsel