mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
lint
This commit is contained in:
parent
2032c857fe
commit
4eefbdbf8f
1 changed files with 8 additions and 7 deletions
|
@ -82,18 +82,15 @@ export class EraserTrail extends AnimatedTrail {
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateElementsToBeErased(restoreToErase?: boolean) {
|
private updateElementsToBeErased(restoreToErase?: boolean) {
|
||||||
let eraserPath = super
|
let eraserPath: GlobalPoint[] =
|
||||||
.getCurrentTrail()
|
super
|
||||||
?.originalPoints?.map((p) => pointFrom<GlobalPoint>(p[0], p[1]));
|
.getCurrentTrail()
|
||||||
|
?.originalPoints?.map((p) => pointFrom<GlobalPoint>(p[0], p[1])) || [];
|
||||||
|
|
||||||
// for efficiency and avoid unnecessary calculations,
|
// for efficiency and avoid unnecessary calculations,
|
||||||
// take only POINTS_ON_TRAIL points to form some number of segments
|
// take only POINTS_ON_TRAIL points to form some number of segments
|
||||||
eraserPath = eraserPath?.slice(eraserPath.length - POINTS_ON_TRAIL);
|
eraserPath = eraserPath?.slice(eraserPath.length - POINTS_ON_TRAIL);
|
||||||
|
|
||||||
if (!eraserPath || eraserPath.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const visibleElementsMap = arrayToMap(this.app.visibleElements);
|
const visibleElementsMap = arrayToMap(this.app.visibleElements);
|
||||||
|
|
||||||
const pathSegments = eraserPath.reduce((acc, point, index) => {
|
const pathSegments = eraserPath.reduce((acc, point, index) => {
|
||||||
|
@ -104,6 +101,10 @@ export class EraserTrail extends AnimatedTrail {
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as LineSegment<GlobalPoint>[]);
|
}, [] as LineSegment<GlobalPoint>[]);
|
||||||
|
|
||||||
|
if (pathSegments.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
for (const element of this.app.visibleElements) {
|
for (const element of this.app.visibleElements) {
|
||||||
// restore only if already added to the to-be-erased set
|
// restore only if already added to the to-be-erased set
|
||||||
if (restoreToErase && this.elementsToErase.has(element.id)) {
|
if (restoreToErase && this.elementsToErase.has(element.id)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue