plant has its own timed/reactive behavior - typically another statechart
This commit is contained in:
parent
b50f52496a
commit
3e5dca437b
19 changed files with 401 additions and 241 deletions
|
|
@ -18,12 +18,15 @@ import { TraceState } from "@/App/App";
|
|||
import { Mode } from "@/statecharts/runtime_types";
|
||||
import { arraysEqual, objectsEqual, setsEqual } from "@/util/util";
|
||||
|
||||
export type VisualEditorState = {
|
||||
export type ConcreteSyntax = {
|
||||
rountangles: Rountangle[];
|
||||
texts: Text[];
|
||||
arrows: Arrow[];
|
||||
diamonds: Diamond[];
|
||||
history: History[];
|
||||
};
|
||||
|
||||
export type VisualEditorState = ConcreteSyntax & {
|
||||
nextID: number;
|
||||
selection: Selection;
|
||||
};
|
||||
|
|
@ -373,6 +376,9 @@ export const VisualEditor = memo(function VisualEditor({state, setState, trace,
|
|||
}, [setState]);
|
||||
|
||||
const onKeyDown = useCallback((e: KeyboardEvent) => {
|
||||
// don't capture keyboard events when focused on an input element:
|
||||
if (["INPUT", "TEXTAREA", "SELECT"].includes(e.target?.tagName)) return;
|
||||
|
||||
if (e.key === "Delete") {
|
||||
// delete selection
|
||||
makeCheckPoint();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ import { InsertMode } from "./VisualEditor";
|
|||
|
||||
export function getKeyHandler(setMode: Dispatch<SetStateAction<InsertMode>>) {
|
||||
return function onKeyDown(e: KeyboardEvent) {
|
||||
// don't capture keyboard events when focused on an input element:
|
||||
if (["INPUT", "TEXTAREA", "SELECT"].includes(e.target?.tagName)) return;
|
||||
|
||||
if (!e.ctrlKey) {
|
||||
if (e.key === "a") {
|
||||
setMode("and");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue