Created
August 12, 2022 11:59
-
-
Save LevelbossMike/357c8c2fea1ec8d132d49a4a772ab089 to your computer and use it in GitHub Desktop.
Editior machine - for statechart visualizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'editor', | |
type: 'parallel', | |
states: { | |
selection: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
SELECT: { | |
target: 'selected', | |
cond: 'selectionIncludesCells' | |
} | |
} | |
}, | |
selected: { | |
on: { | |
SELECT: [ | |
{ | |
target: 'selected', | |
cond: 'selectionIncludesCells' | |
}, | |
{ | |
target: 'idle' | |
} | |
] | |
}, | |
MOVE_SELECTION: { | |
actions: ['moveCells'] | |
}, | |
DELETE_SELECTION: { | |
actions: ['deleteCells'] | |
}, | |
} | |
} | |
}, | |
// what interactions are possible atm | |
// this most likely depends on the thing we | |
// selected | |
interaction: { | |
initial: 'none', | |
states: { | |
none: {}, | |
state: { | |
on: { | |
MOVE: {}, | |
COLLAPSE: {} | |
} | |
}, | |
states: { | |
on: { | |
MOVE: {}, | |
} | |
}, | |
event: { | |
on: { | |
DELETE: {}, | |
CONNECT: {} | |
} | |
} | |
}, | |
}, | |
zoom: { | |
initial: 'active', | |
states: { | |
active: { | |
on: { | |
PAN_ZOOM: {}, | |
RESET_ZOOM: {} | |
} | |
} | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment