editor: better rendering of helper outlines
This commit is contained in:
parent
9401c02800
commit
e8fda9bdf0
8 changed files with 95 additions and 116 deletions
|
|
@ -21,11 +21,18 @@ export type Arrow = {
|
|||
uid: string;
|
||||
} & Line2D;
|
||||
|
||||
export type History = {
|
||||
uid: string;
|
||||
kind: "shallow" | "deep";
|
||||
topLeft: Vec2D;
|
||||
};
|
||||
|
||||
export type VisualEditorState = {
|
||||
rountangles: Rountangle[];
|
||||
texts: Text[];
|
||||
arrows: Arrow[];
|
||||
diamonds: Diamond[];
|
||||
history: History[];
|
||||
nextID: number;
|
||||
};
|
||||
|
||||
|
|
@ -34,19 +41,7 @@ export type RountanglePart = "left" | "top" | "right" | "bottom";
|
|||
export type ArrowPart = "start" | "end";
|
||||
|
||||
export const emptyState: VisualEditorState = {
|
||||
rountangles: [], texts: [], arrows: [], diamonds: [], nextID: 0,
|
||||
};
|
||||
|
||||
export const onOffStateMachine = {
|
||||
rountangles: [
|
||||
{ uid: "0", topLeft: { x: 100, y: 100 }, size: { x: 100, y: 100 }, kind: "and" },
|
||||
{ uid: "1", topLeft: { x: 100, y: 300 }, size: { x: 100, y: 100 }, kind: "and" },
|
||||
],
|
||||
texts: [],
|
||||
arrows: [
|
||||
{ uid: "2", start: { x: 150, y: 200 }, end: { x: 160, y: 300 } },
|
||||
],
|
||||
nextID: 3,
|
||||
rountangles: [], texts: [], arrows: [], diamonds: [], history: [], nextID: 0,
|
||||
};
|
||||
|
||||
// used to find which rountangle an arrow connects to (src/tgt)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ type EnteredScope = { enteredStates: Mode } & ActionScope;
|
|||
export function entryActions(simtime: number, state: ConcreteState, actionScope: ActionScope): ActionScope {
|
||||
// console.log('enter', stateDescription(state), '...');
|
||||
let {environment, ...rest} = actionScope;
|
||||
environment = environment.pushScope();
|
||||
// environment = environment.pushScope();
|
||||
for (const action of state.entryActions) {
|
||||
({environment, ...rest} = execAction(action, {environment, ...rest}));
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ export function exitActions(simtime: number, state: ConcreteState, actionScope:
|
|||
// remove all timers of 'state':
|
||||
return oldTimers.filter(([_, {state: s}]) => s !== state.uid);
|
||||
}, []);
|
||||
environment = environment.popScope();
|
||||
// environment = environment.popScope();
|
||||
return {...actionScope, environment};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ export type TimerElapseEvent = {
|
|||
|
||||
export type Mode = Set<string>; // set of active states
|
||||
|
||||
// export type Environment = ReadonlyMap<string, any>; // variable name -> value
|
||||
|
||||
export class Environment {
|
||||
scopes: ReadonlyMap<string, any>[]; // array of nested scopes - scope at the back of the array is used first
|
||||
|
||||
|
|
@ -114,7 +112,6 @@ export type RaisedEvent = {
|
|||
param?: any,
|
||||
}
|
||||
|
||||
|
||||
export type RaisedEvents = {
|
||||
internalEvents: RaisedEvent[];
|
||||
outputEvents: RaisedEvent[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue