mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
signature tweaks
This commit is contained in:
parent
3a85537c2f
commit
806b6ed24d
1 changed files with 8 additions and 8 deletions
|
@ -23,7 +23,7 @@ import type {
|
||||||
GlobalPoint,
|
GlobalPoint,
|
||||||
LineSegment,
|
LineSegment,
|
||||||
} from "@excalidraw/math/types";
|
} from "@excalidraw/math/types";
|
||||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
|
|
||||||
import { AnimatedTrail } from "../animated-trail";
|
import { AnimatedTrail } from "../animated-trail";
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ export class EraserTrail extends AnimatedTrail {
|
||||||
(el) => !el.locked,
|
(el) => !el.locked,
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibleElementsMap = arrayToMap(candidateElements);
|
const candidateElementsMap = arrayToMap(candidateElements);
|
||||||
|
|
||||||
const pathSegments = eraserPath.reduce((acc, point, index) => {
|
const pathSegments = eraserPath.reduce((acc, point, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
|
@ -117,7 +117,7 @@ export class EraserTrail extends AnimatedTrail {
|
||||||
element,
|
element,
|
||||||
this.segmentsCache,
|
this.segmentsCache,
|
||||||
this.geometricShapesCache,
|
this.geometricShapesCache,
|
||||||
visibleElementsMap,
|
candidateElementsMap,
|
||||||
this.app,
|
this.app,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ export class EraserTrail extends AnimatedTrail {
|
||||||
element,
|
element,
|
||||||
this.segmentsCache,
|
this.segmentsCache,
|
||||||
this.geometricShapesCache,
|
this.geometricShapesCache,
|
||||||
visibleElementsMap,
|
candidateElementsMap,
|
||||||
this.app,
|
this.app,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -207,14 +207,14 @@ const eraserTest = (
|
||||||
pathSegments: LineSegment<GlobalPoint>[],
|
pathSegments: LineSegment<GlobalPoint>[],
|
||||||
element: ExcalidrawElement,
|
element: ExcalidrawElement,
|
||||||
elementsSegments: ElementsSegmentsMap,
|
elementsSegments: ElementsSegmentsMap,
|
||||||
shapesCache = new Map<string, GeometricShape<GlobalPoint>>(),
|
shapesCache: Map<string, GeometricShape<GlobalPoint>>,
|
||||||
visibleElementsMap = new Map<string, ExcalidrawElement>(),
|
elementsMap: ElementsMap,
|
||||||
app: App,
|
app: App,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
let shape = shapesCache.get(element.id);
|
let shape = shapesCache.get(element.id);
|
||||||
|
|
||||||
if (!shape) {
|
if (!shape) {
|
||||||
shape = getElementShape<GlobalPoint>(element, visibleElementsMap);
|
shape = getElementShape<GlobalPoint>(element, elementsMap);
|
||||||
shapesCache.set(element.id, shape);
|
shapesCache.set(element.id, shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ const eraserTest = (
|
||||||
let elementSegments = elementsSegments.get(element.id);
|
let elementSegments = elementsSegments.get(element.id);
|
||||||
|
|
||||||
if (!elementSegments) {
|
if (!elementSegments) {
|
||||||
elementSegments = getElementLineSegments(element, visibleElementsMap);
|
elementSegments = getElementLineSegments(element, elementsMap);
|
||||||
elementsSegments.set(element.id, elementSegments);
|
elementsSegments.set(element.id, elementSegments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue