mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: erasing locked elements
This commit is contained in:
parent
58f7d33d80
commit
3a85537c2f
1 changed files with 6 additions and 2 deletions
|
@ -91,7 +91,11 @@ export class EraserTrail extends AnimatedTrail {
|
|||
// take only POINTS_ON_TRAIL points to form some number of segments
|
||||
eraserPath = eraserPath?.slice(eraserPath.length - POINTS_ON_TRAIL);
|
||||
|
||||
const visibleElementsMap = arrayToMap(this.app.visibleElements);
|
||||
const candidateElements = this.app.visibleElements.filter(
|
||||
(el) => !el.locked,
|
||||
);
|
||||
|
||||
const visibleElementsMap = arrayToMap(candidateElements);
|
||||
|
||||
const pathSegments = eraserPath.reduce((acc, point, index) => {
|
||||
if (index === 0) {
|
||||
|
@ -105,7 +109,7 @@ export class EraserTrail extends AnimatedTrail {
|
|||
return [];
|
||||
}
|
||||
|
||||
for (const element of this.app.visibleElements) {
|
||||
for (const element of candidateElements) {
|
||||
// restore only if already added to the to-be-erased set
|
||||
if (restoreToErase && this.elementsToErase.has(element.id)) {
|
||||
const intersects = eraserTest(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue