More refactor

This commit is contained in:
Mark Tolmacs 2024-09-25 11:59:27 +02:00
parent 392dd5b0b8
commit b697f63cad
No known key found for this signature in database
18 changed files with 206 additions and 199 deletions

View file

@ -13,15 +13,15 @@ import {
} from "../../packages/excalidraw/components/icons";
import { STORAGE_KEYS } from "../app_constants";
import {
isLineSegment,
isSegment,
type GlobalPoint,
type LineSegment,
type Segment,
} from "../../packages/math";
const renderLine = (
context: CanvasRenderingContext2D,
zoom: number,
segment: LineSegment<GlobalPoint>,
segment: Segment<GlobalPoint>,
color: string,
) => {
context.save();
@ -52,11 +52,11 @@ const render = (
) => {
frame.forEach((el: DebugElement) => {
switch (true) {
case isLineSegment(el.data):
case isSegment(el.data):
renderLine(
context,
appState.zoom.value,
el.data as LineSegment<GlobalPoint>,
el.data as Segment<GlobalPoint>,
el.color,
);
break;