Last active
July 20, 2022 20:26
-
-
Save erikras/6ff05b36083b8c9404c0c58b68c81c5b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
const machine = Machine({ | |
id: 'labelEditing', | |
initial: 'idle', | |
context: {x:400,y:400}, | |
states: { | |
idle: { | |
on: { | |
ADD_LAYER: { | |
target: 'selection', | |
actions: 'addLayer', | |
}, | |
DRAG_START: { | |
target: 'dragging', | |
actions: 'dragStart', | |
}, | |
EDIT_START: { | |
target: 'editing', | |
actions: 'writeSelection', | |
}, | |
SELECT_LAYER: { | |
target: 'selection', | |
actions: 'writeSelection', | |
}, | |
}, | |
}, | |
dragging: { | |
on: { | |
MOUSE_UP: { | |
target: 'selection', | |
actions: 'dragEnd', | |
}, | |
MOUSE_MOVE: { | |
target: 'dragging', | |
actions: 'drag', | |
}, | |
}, | |
}, | |
editing: { | |
on: { | |
UPDATE_TEXT: {target: 'selection', actions: 'updateText'}, | |
}, | |
}, | |
resizing: { | |
on: { | |
MOUSE_UP: {target: 'selection', actions: 'resizeEnd'}, | |
MOUSE_MOVE: { | |
target: 'resizing', | |
actions: 'resize', | |
}, | |
}, | |
}, | |
selection: { | |
on: { | |
ADD_LAYER: { | |
target: 'selection', | |
actions: 'addLayer', | |
}, | |
ARROW_KEY: { | |
target: 'selection', | |
actions: 'arrowKey', | |
}, | |
CANCEL: {target: 'idle', actions: 'clearContext'}, | |
DRAG_START: { | |
target: 'dragging', | |
actions: 'dragStart', | |
}, | |
EDIT_START: { | |
target: 'editing', | |
actions: 'editStart', | |
}, | |
RESIZE_START: {target: 'resizing', actions: 'resizeStart'}, | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment