move 'selection' part of state into same object as rest of editor state

This commit is contained in:
Joeri Exelmans 2025-10-21 10:21:26 +02:00
parent 9e79537b6e
commit 297905a4af
8 changed files with 66 additions and 58 deletions

View file

@ -1,6 +1,6 @@
import { Rect2D, Vec2D, Line2D, euclideanDistance, intersectLines, isWithin, lineBBox, subtractV2D } from "../VisualEditor/geometry";
import { ARROW_SNAP_THRESHOLD, HISTORY_RADIUS, TEXT_SNAP_THRESHOLD } from "../VisualEditor/parameters";
import { sides } from "../VisualEditor/VisualEditor";
import { sides, VisualEditorState } from "../VisualEditor/VisualEditor";
export type Rountangle = {
uid: string;
@ -27,15 +27,6 @@ export type History = {
topLeft: Vec2D;
};
export type VisualEditorState = {
rountangles: Rountangle[];
texts: Text[];
arrows: Arrow[];
diamonds: Diamond[];
history: History[];
nextID: number;
};
// independently moveable parts of our shapes:
export type RountanglePart = "left" | "top" | "right" | "bottom";
export type ArrowPart = "start" | "end";

View file

@ -1,4 +1,5 @@
import { findNearestArrow, findNearestHistory, findNearestSide, findRountangle, RountanglePart, VisualEditorState } from "./concrete_syntax";
import { VisualEditorState } from "@/VisualEditor/VisualEditor";
import { findNearestArrow, findNearestHistory, findNearestSide, findRountangle, RountanglePart } from "./concrete_syntax";
export type Connections = {
arrow2SideMap: Map<string,[{ uid: string; part: RountanglePart; } | undefined, { uid: string; part: RountanglePart; } | undefined]>,

View file

@ -1,10 +1,11 @@
import { ConcreteState, HistoryState, OrState, PseudoState, Statechart, Transition } from "./abstract_syntax";
import { Rountangle, VisualEditorState } from "./concrete_syntax";
import { Rountangle } from "./concrete_syntax";
import { isEntirelyWithin, Rect2D } from "../VisualEditor/geometry";
import { Action, EventTrigger, Expression, ParsedText } from "./label_ast";
import { parse as parseLabel, SyntaxError } from "./label_parser";
import { Connections } from "./detect_connections";
import { HISTORY_RADIUS } from "../VisualEditor/parameters";
import { VisualEditorState } from "@/VisualEditor/VisualEditor";
export type TraceableError = {
shapeUid: string;