refactor: move elementLocked to activeTool.locked (#4983)

* refactor: move elementLocked to activeTool.locked

* fix

* fix snap

* update docs

* Update src/packages/excalidraw/CHANGELOG.md

* revert

* make lastActiveToolBeforeEraser required and nullable

* fix snap
This commit is contained in:
Aakansha Doshi 2022-03-29 17:10:19 +05:30 committed by GitHub
parent 1331cffe93
commit 2fa69ddc32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 199 additions and 113 deletions

View file

@ -3,6 +3,8 @@
exports[`contextMenu element selecting 'Add to library' in context menu adds element to library: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -26,7 +28,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -176,6 +177,8 @@ exports[`contextMenu element selecting 'Add to library' in context menu adds ele
exports[`contextMenu element selecting 'Bring forward' in context menu brings element forward: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -199,7 +202,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -505,6 +507,8 @@ exports[`contextMenu element selecting 'Bring forward' in context menu brings el
exports[`contextMenu element selecting 'Bring to front' in context menu brings element to front: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -528,7 +532,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -834,6 +837,8 @@ exports[`contextMenu element selecting 'Bring to front' in context menu brings e
exports[`contextMenu element selecting 'Copy styles' in context menu copies styles: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -857,7 +862,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -1007,6 +1011,8 @@ exports[`contextMenu element selecting 'Copy styles' in context menu copies styl
exports[`contextMenu element selecting 'Delete' in context menu deletes element: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -1030,7 +1036,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -1215,6 +1220,8 @@ exports[`contextMenu element selecting 'Delete' in context menu deletes element:
exports[`contextMenu element selecting 'Duplicate' in context menu duplicates element: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -1238,7 +1245,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -1480,6 +1486,8 @@ exports[`contextMenu element selecting 'Duplicate' in context menu duplicates el
exports[`contextMenu element selecting 'Group selection' in context menu groups selected elements: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -1503,7 +1511,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -1827,6 +1834,8 @@ exports[`contextMenu element selecting 'Group selection' in context menu groups
exports[`contextMenu element selecting 'Paste styles' in context menu pastes styles: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -1850,7 +1859,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -2604,6 +2612,8 @@ exports[`contextMenu element selecting 'Paste styles' in context menu pastes sty
exports[`contextMenu element selecting 'Send backward' in context menu sends element backward: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -2627,7 +2637,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -2933,6 +2942,8 @@ exports[`contextMenu element selecting 'Send backward' in context menu sends ele
exports[`contextMenu element selecting 'Send to back' in context menu sends element to back: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -2956,7 +2967,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -3262,6 +3272,8 @@ exports[`contextMenu element selecting 'Send to back' in context menu sends elem
exports[`contextMenu element selecting 'Ungroup selection' in context menu ungroups selected group: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -3285,7 +3297,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -3669,6 +3680,8 @@ exports[`contextMenu element selecting 'Ungroup selection' in context menu ungro
exports[`contextMenu element shows 'Group selection' in context menu for multiple selected elements: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -3692,7 +3705,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -3940,6 +3952,8 @@ exports[`contextMenu element shows 'Group selection' in context menu for multipl
exports[`contextMenu element shows 'Ungroup selection' in context menu for group inside selected elements: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -3963,7 +3977,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -4290,6 +4303,8 @@ exports[`contextMenu element shows 'Ungroup selection' in context menu for group
exports[`contextMenu element shows context menu for canvas: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -4313,7 +4328,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -4394,6 +4408,8 @@ exports[`contextMenu element shows context menu for canvas: [end of test] number
exports[`contextMenu element shows context menu for element: [end of test] appState 1`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -4417,7 +4433,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -4476,6 +4491,8 @@ Object {
exports[`contextMenu element shows context menu for element: [end of test] appState 2`] = `
Object {
"activeTool": Object {
"lastActiveToolBeforeEraser": null,
"locked": false,
"type": "selection",
},
"collaborators": Map {},
@ -4499,7 +4516,6 @@ Object {
"editingElement": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementLocked": false,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,