Add NonDeleted<ExcalidrawElement> (#1068)
* add NonDeleted * make test:all script run tests without prompt * rename helper * replace with helper * make element contructors return nonDeleted elements * cache filtered elements where appliacable for better perf * rename manager element getter * remove unnecessary assertion * fix test * make element types in resizeElement into nonDeleted Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
@ -2,7 +2,10 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
||||
import { RoughSVG } from "roughjs/bin/svg";
|
||||
|
||||
import { FlooredNumber, AppState } from "../types";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
@ -74,9 +77,9 @@ function strokeCircle(
|
||||
}
|
||||
|
||||
export function renderScene(
|
||||
allElements: readonly ExcalidrawElement[],
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
selectionElement: ExcalidrawElement | null,
|
||||
selectionElement: NonDeletedExcalidrawElement | null,
|
||||
scale: number,
|
||||
rc: RoughCanvas,
|
||||
canvas: HTMLCanvasElement,
|
||||
@ -99,8 +102,6 @@ export function renderScene(
|
||||
return { atLeastOneVisibleElement: false };
|
||||
}
|
||||
|
||||
const elements = allElements.filter((element) => !element.isDeleted);
|
||||
|
||||
const context = canvas.getContext("2d")!;
|
||||
context.scale(scale, scale);
|
||||
|
||||
@ -493,7 +494,7 @@ function isVisibleElement(
|
||||
|
||||
// This should be only called for exporting purposes
|
||||
export function renderSceneToSvg(
|
||||
elements: readonly ExcalidrawElement[],
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
rsvg: RoughSVG,
|
||||
svgRoot: SVGElement,
|
||||
{
|
||||
|
Reference in New Issue
Block a user