Adds session completes when leaving a creation/editing state
This commit is contained in:
parent
679209970f
commit
66ec007e4f
1 changed files with 19 additions and 13 deletions
|
@ -151,6 +151,7 @@ const state = createState({
|
||||||
do: 'deleteSelection',
|
do: 'deleteSelection',
|
||||||
else: ['selectAll', 'deleteSelection'],
|
else: ['selectAll', 'deleteSelection'],
|
||||||
},
|
},
|
||||||
|
SELECTED_ALL: { to: 'selecting', do: 'selectAll' },
|
||||||
CHANGED_PAGE: 'changePage',
|
CHANGED_PAGE: 'changePage',
|
||||||
CREATED_PAGE: ['clearSelectedIds', 'createPage'],
|
CREATED_PAGE: ['clearSelectedIds', 'createPage'],
|
||||||
DELETED_PAGE: { unless: 'hasOnlyOnePage', do: 'deletePage' },
|
DELETED_PAGE: { unless: 'hasOnlyOnePage', do: 'deletePage' },
|
||||||
|
@ -204,7 +205,6 @@ const state = createState({
|
||||||
if: ['hasSelection', 'selectionIncludesGroups'],
|
if: ['hasSelection', 'selectionIncludesGroups'],
|
||||||
do: 'ungroupSelection',
|
do: 'ungroupSelection',
|
||||||
},
|
},
|
||||||
SELECTED_ALL: { to: 'selecting', do: 'selectAll' },
|
|
||||||
NUDGED: { do: 'nudgeSelection' },
|
NUDGED: { do: 'nudgeSelection' },
|
||||||
ZOOMED_CAMERA: {
|
ZOOMED_CAMERA: {
|
||||||
do: 'zoomCamera',
|
do: 'zoomCamera',
|
||||||
|
@ -361,29 +361,31 @@ const state = createState({
|
||||||
},
|
},
|
||||||
rotatingSelection: {
|
rotatingSelection: {
|
||||||
onEnter: 'startRotateSession',
|
onEnter: 'startRotateSession',
|
||||||
onExit: 'clearBoundsRotation',
|
onExit: ['completeSession', 'clearBoundsRotation'],
|
||||||
on: {
|
on: {
|
||||||
MOVED_POINTER: 'updateRotateSession',
|
MOVED_POINTER: 'updateRotateSession',
|
||||||
PANNED_CAMERA: 'updateRotateSession',
|
PANNED_CAMERA: 'updateRotateSession',
|
||||||
PRESSED_SHIFT_KEY: 'keyUpdateRotateSession',
|
PRESSED_SHIFT_KEY: 'keyUpdateRotateSession',
|
||||||
RELEASED_SHIFT_KEY: 'keyUpdateRotateSession',
|
RELEASED_SHIFT_KEY: 'keyUpdateRotateSession',
|
||||||
STOPPED_POINTING: { do: 'completeSession', to: 'selecting' },
|
STOPPED_POINTING: { to: 'selecting' },
|
||||||
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
transformingSelection: {
|
transformingSelection: {
|
||||||
onEnter: 'startTransformSession',
|
onEnter: 'startTransformSession',
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
// MOVED_POINTER: 'updateTransformSession', using hacks.fastTransform
|
// MOVED_POINTER: 'updateTransformSession', using hacks.fastTransform
|
||||||
PANNED_CAMERA: 'updateTransformSession',
|
PANNED_CAMERA: 'updateTransformSession',
|
||||||
PRESSED_SHIFT_KEY: 'keyUpdateTransformSession',
|
PRESSED_SHIFT_KEY: 'keyUpdateTransformSession',
|
||||||
RELEASED_SHIFT_KEY: 'keyUpdateTransformSession',
|
RELEASED_SHIFT_KEY: 'keyUpdateTransformSession',
|
||||||
STOPPED_POINTING: { do: 'completeSession', to: 'selecting' },
|
STOPPED_POINTING: { to: 'selecting' },
|
||||||
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
translatingSelection: {
|
translatingSelection: {
|
||||||
onEnter: 'startTranslateSession',
|
onEnter: 'startTranslateSession',
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
MOVED_POINTER: 'updateTranslateSession',
|
MOVED_POINTER: 'updateTranslateSession',
|
||||||
PANNED_CAMERA: 'updateTranslateSession',
|
PANNED_CAMERA: 'updateTranslateSession',
|
||||||
|
@ -391,22 +393,24 @@ const state = createState({
|
||||||
RELEASED_SHIFT_KEY: 'keyUpdateTranslateSession',
|
RELEASED_SHIFT_KEY: 'keyUpdateTranslateSession',
|
||||||
PRESSED_ALT_KEY: 'keyUpdateTranslateSession',
|
PRESSED_ALT_KEY: 'keyUpdateTranslateSession',
|
||||||
RELEASED_ALT_KEY: 'keyUpdateTranslateSession',
|
RELEASED_ALT_KEY: 'keyUpdateTranslateSession',
|
||||||
STOPPED_POINTING: { do: 'completeSession', to: 'selecting' },
|
STOPPED_POINTING: { to: 'selecting' },
|
||||||
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
translatingHandles: {
|
translatingHandles: {
|
||||||
onEnter: 'startHandleSession',
|
onEnter: 'startHandleSession',
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
MOVED_POINTER: 'updateHandleSession',
|
MOVED_POINTER: 'updateHandleSession',
|
||||||
PANNED_CAMERA: 'updateHandleSession',
|
PANNED_CAMERA: 'updateHandleSession',
|
||||||
PRESSED_SHIFT_KEY: 'keyUpdateHandleSession',
|
PRESSED_SHIFT_KEY: 'keyUpdateHandleSession',
|
||||||
RELEASED_SHIFT_KEY: 'keyUpdateHandleSession',
|
RELEASED_SHIFT_KEY: 'keyUpdateHandleSession',
|
||||||
STOPPED_POINTING: { do: 'completeSession', to: 'selecting' },
|
STOPPED_POINTING: { to: 'selecting' },
|
||||||
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
brushSelecting: {
|
brushSelecting: {
|
||||||
|
onExit: 'completeSession',
|
||||||
onEnter: [
|
onEnter: [
|
||||||
{
|
{
|
||||||
unless: ['isPressingMetaKey', 'isPressingShiftKey'],
|
unless: ['isPressingMetaKey', 'isPressingShiftKey'],
|
||||||
|
@ -416,10 +420,9 @@ const state = createState({
|
||||||
'startBrushSession',
|
'startBrushSession',
|
||||||
],
|
],
|
||||||
on: {
|
on: {
|
||||||
STARTED_PINCHING: { do: 'completeSession', to: 'pinching' },
|
|
||||||
// MOVED_POINTER: 'updateBrushSession', using hacks.fastBrushSelect
|
// MOVED_POINTER: 'updateBrushSession', using hacks.fastBrushSelect
|
||||||
PANNED_CAMERA: 'updateBrushSession',
|
PANNED_CAMERA: 'updateBrushSession',
|
||||||
STOPPED_POINTING: { do: 'completeSession', to: 'selecting' },
|
STOPPED_POINTING: { to: 'selecting' },
|
||||||
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
CANCELLED: { do: 'cancelSession', to: 'selecting' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -427,11 +430,11 @@ const state = createState({
|
||||||
},
|
},
|
||||||
editingShape: {
|
editingShape: {
|
||||||
onEnter: 'startEditSession',
|
onEnter: 'startEditSession',
|
||||||
onExit: 'clearEditingId',
|
onExit: ['completeSession', 'clearEditingId'],
|
||||||
on: {
|
on: {
|
||||||
EDITED_SHAPE: { do: 'updateEditSession' },
|
EDITED_SHAPE: { do: 'updateEditSession' },
|
||||||
|
|
||||||
BLURRED_EDITING_SHAPE: { do: 'completeSession', to: 'selecting' },
|
BLURRED_EDITING_SHAPE: { to: 'selecting' },
|
||||||
CANCELLED: [
|
CANCELLED: [
|
||||||
{
|
{
|
||||||
get: 'editingShape',
|
get: 'editingShape',
|
||||||
|
@ -529,6 +532,7 @@ const state = createState({
|
||||||
},
|
},
|
||||||
editing: {
|
editing: {
|
||||||
onEnter: 'startDrawSession',
|
onEnter: 'startDrawSession',
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
CANCELLED: {
|
CANCELLED: {
|
||||||
do: 'breakSession',
|
do: 'breakSession',
|
||||||
|
@ -572,9 +576,7 @@ const state = createState({
|
||||||
{
|
{
|
||||||
if: 'isToolLocked',
|
if: 'isToolLocked',
|
||||||
to: 'dot.creating',
|
to: 'dot.creating',
|
||||||
else: {
|
else: { to: 'selecting' },
|
||||||
to: 'selecting',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
CANCELLED: {
|
CANCELLED: {
|
||||||
|
@ -593,6 +595,7 @@ const state = createState({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
active: {
|
active: {
|
||||||
|
onExit: 'completeSession',
|
||||||
onEnter: 'startTranslateSession',
|
onEnter: 'startTranslateSession',
|
||||||
on: {
|
on: {
|
||||||
MOVED_POINTER: 'updateTranslateSession',
|
MOVED_POINTER: 'updateTranslateSession',
|
||||||
|
@ -625,6 +628,7 @@ const state = createState({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
editing: {
|
editing: {
|
||||||
|
onExit: 'completeSession',
|
||||||
onEnter: 'startArrowSession',
|
onEnter: 'startArrowSession',
|
||||||
on: {
|
on: {
|
||||||
STOPPED_POINTING: [
|
STOPPED_POINTING: [
|
||||||
|
@ -837,6 +841,7 @@ const state = createState({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
drawingShape: {
|
drawingShape: {
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
STOPPED_POINTING: [
|
STOPPED_POINTING: [
|
||||||
'completeSession',
|
'completeSession',
|
||||||
|
@ -862,6 +867,7 @@ const state = createState({
|
||||||
},
|
},
|
||||||
direction: {
|
direction: {
|
||||||
onEnter: 'startDirectionSession',
|
onEnter: 'startDirectionSession',
|
||||||
|
onExit: 'completeSession',
|
||||||
on: {
|
on: {
|
||||||
MOVED_POINTER: 'updateDirectionSession',
|
MOVED_POINTER: 'updateDirectionSession',
|
||||||
PANNED_CAMERA: 'updateDirectionSession',
|
PANNED_CAMERA: 'updateDirectionSession',
|
||||||
|
|
Loading…
Reference in a new issue