Steve Ruiz 4 роки тому
джерело
коміт
6729435696

+ 1
- 1
state/commands/create-page.ts Переглянути файл

11
   history.execute(
11
   history.execute(
12
     data,
12
     data,
13
     new Command({
13
     new Command({
14
-      name: 'change_page',
14
+      name: 'create_page',
15
       category: 'canvas',
15
       category: 'canvas',
16
       do(data) {
16
       do(data) {
17
         const { page, pageState, currentPageId } = snapshot
17
         const { page, pageState, currentPageId } = snapshot

+ 2
- 4
state/commands/delete-page.ts Переглянути файл

2
 import history from '../history'
2
 import history from '../history'
3
 import { Data } from 'types'
3
 import { Data } from 'types'
4
 import { current } from 'immer'
4
 import { current } from 'immer'
5
-import { getPage, getSelectedShapes } from 'utils/utils'
6
-import { getShapeUtils } from 'lib/shape-utils'
7
 import vec from 'utils/vec'
5
 import vec from 'utils/vec'
8
 import storage from 'state/storage'
6
 import storage from 'state/storage'
9
 
7
 
10
-export default function changePage(data: Data, pageId: string) {
8
+export default function deletePage(data: Data, pageId: string) {
11
   const snapshot = getSnapshot(data, pageId)
9
   const snapshot = getSnapshot(data, pageId)
12
 
10
 
13
   history.execute(
11
   history.execute(
14
     data,
12
     data,
15
     new Command({
13
     new Command({
16
-      name: 'change_page',
14
+      name: 'delete_page',
17
       category: 'canvas',
15
       category: 'canvas',
18
       do(data) {
16
       do(data) {
19
         data.currentPageId = snapshot.nextPageId
17
         data.currentPageId = snapshot.nextPageId

+ 1
- 1
state/commands/delete-selected.ts Переглянути файл

37
   history.execute(
37
   history.execute(
38
     data,
38
     data,
39
     new Command({
39
     new Command({
40
-      name: 'delete_shapes',
40
+      name: 'delete_selection',
41
       category: 'canvas',
41
       category: 'canvas',
42
       manualSelection: true,
42
       manualSelection: true,
43
       do(data) {
43
       do(data) {

+ 1
- 1
state/commands/distribute.ts Переглянути файл

34
   history.execute(
34
   history.execute(
35
     data,
35
     data,
36
     new Command({
36
     new Command({
37
-      name: 'distributed',
37
+      name: 'distribute_shapes',
38
       category: 'canvas',
38
       category: 'canvas',
39
       do(data) {
39
       do(data) {
40
         const { shapes } = getPage(data, currentPageId)
40
         const { shapes } = getPage(data, currentPageId)

+ 1
- 0
state/commands/duplicate.ts Переглянути файл

19
     ...shape,
19
     ...shape,
20
     id: uniqueId(),
20
     id: uniqueId(),
21
     point: vec.add(shape.point, vec.div([16, 16], getCurrentCamera(data).zoom)),
21
     point: vec.add(shape.point, vec.div([16, 16], getCurrentCamera(data).zoom)),
22
+    isGenerated: false,
22
   }))
23
   }))
23
 
24
 
24
   history.execute(
25
   history.execute(

+ 3
- 3
state/commands/edit.ts Переглянути файл

1
 import Command from './command'
1
 import Command from './command'
2
 import history from '../history'
2
 import history from '../history'
3
 import { Data } from 'types'
3
 import { Data } from 'types'
4
-import { getPage, getShape } from 'utils/utils'
4
+import { getPage } from 'utils/utils'
5
 import { EditSnapshot } from 'state/sessions/edit-session'
5
 import { EditSnapshot } from 'state/sessions/edit-session'
6
 import { getShapeUtils } from 'lib/shape-utils'
6
 import { getShapeUtils } from 'lib/shape-utils'
7
 
7
 
8
-export default function handleCommand(
8
+export default function editCommand(
9
   data: Data,
9
   data: Data,
10
   before: EditSnapshot,
10
   before: EditSnapshot,
11
   after: EditSnapshot
11
   after: EditSnapshot
13
   history.execute(
13
   history.execute(
14
     data,
14
     data,
15
     new Command({
15
     new Command({
16
-      name: 'edited_shape',
16
+      name: 'edit_shape',
17
       category: 'canvas',
17
       category: 'canvas',
18
       do(data) {
18
       do(data) {
19
         const { initialShape, currentPageId } = after
19
         const { initialShape, currentPageId } = after

+ 1
- 1
state/commands/generate.ts Переглянути файл

33
   history.execute(
33
   history.execute(
34
     data,
34
     data,
35
     new Command({
35
     new Command({
36
-      name: 'translate_shapes',
36
+      name: 'generate_shapes',
37
       category: 'canvas',
37
       category: 'canvas',
38
       do(data) {
38
       do(data) {
39
         const { shapes } = getPage(data)
39
         const { shapes } = getPage(data)

+ 0
- 2
state/commands/group.ts Переглянути файл

11
 } from 'utils/utils'
11
 } from 'utils/utils'
12
 import { current } from 'immer'
12
 import { current } from 'immer'
13
 import { createShape, getShapeUtils } from 'lib/shape-utils'
13
 import { createShape, getShapeUtils } from 'lib/shape-utils'
14
-import { PropsOfType } from 'types'
15
-import { uniqueId } from 'utils/utils'
16
 import commands from '.'
14
 import commands from '.'
17
 
15
 
18
 export default function groupCommand(data: Data) {
16
 export default function groupCommand(data: Data) {

+ 2
- 2
state/commands/move-to-page.ts Переглянути файл

15
 import vec from 'utils/vec'
15
 import vec from 'utils/vec'
16
 import storage from 'state/storage'
16
 import storage from 'state/storage'
17
 
17
 
18
-export default function nudgeCommand(data: Data, newPageId: string) {
18
+export default function moveToPageCommand(data: Data, newPageId: string) {
19
   const { currentPageId: oldPageId } = data
19
   const { currentPageId: oldPageId } = data
20
   const oldPage = getPage(data)
20
   const oldPage = getPage(data)
21
   const selectedIds = setToArray(getSelectedIds(data))
21
   const selectedIds = setToArray(getSelectedIds(data))
35
   history.execute(
35
   history.execute(
36
     data,
36
     data,
37
     new Command({
37
     new Command({
38
-      name: 'set_direction',
38
+      name: 'move_to_page',
39
       category: 'canvas',
39
       category: 'canvas',
40
       manualSelection: true,
40
       manualSelection: true,
41
       do(data) {
41
       do(data) {

+ 1
- 1
state/commands/move.ts Переглянути файл

24
   history.execute(
24
   history.execute(
25
     data,
25
     data,
26
     new Command({
26
     new Command({
27
-      name: 'move_shapes',
27
+      name: 'change_child_index',
28
       category: 'canvas',
28
       category: 'canvas',
29
       manualSelection: true,
29
       manualSelection: true,
30
       do(data) {
30
       do(data) {

+ 1
- 1
state/commands/nudge.ts Переглянути файл

17
   history.execute(
17
   history.execute(
18
     data,
18
     data,
19
     new Command({
19
     new Command({
20
-      name: 'set_direction',
20
+      name: 'nudge_shapes',
21
       category: 'canvas',
21
       category: 'canvas',
22
       do(data) {
22
       do(data) {
23
         const { shapes } = getPage(data, currentPageId)
23
         const { shapes } = getPage(data, currentPageId)

+ 1
- 1
state/commands/paste.ts Переглянути файл

44
   history.execute(
44
   history.execute(
45
     data,
45
     data,
46
     new Command({
46
     new Command({
47
-      name: 'pasting_new_shapes',
47
+      name: 'paste_new_shapes',
48
       category: 'canvas',
48
       category: 'canvas',
49
       manualSelection: true,
49
       manualSelection: true,
50
       do(data) {
50
       do(data) {

+ 1
- 1
state/commands/rotate-ccw.ts Переглянути файл

60
   history.execute(
60
   history.execute(
61
     data,
61
     data,
62
     new Command({
62
     new Command({
63
-      name: 'translate_shapes',
63
+      name: 'rotate_ccw',
64
       category: 'canvas',
64
       category: 'canvas',
65
       do(data) {
65
       do(data) {
66
         const { shapes } = getPage(data, currentPageId)
66
         const { shapes } = getPage(data, currentPageId)

+ 1
- 1
state/commands/rotate.ts Переглянути файл

13
   history.execute(
13
   history.execute(
14
     data,
14
     data,
15
     new Command({
15
     new Command({
16
-      name: 'translate_shapes',
16
+      name: 'rotate_shapes',
17
       category: 'canvas',
17
       category: 'canvas',
18
       do(data) {
18
       do(data) {
19
         const { shapes } = getPage(data)
19
         const { shapes } = getPage(data)

+ 8
- 8
state/commands/stretch.ts Переглянути файл

1
-import Command from "./command"
2
-import history from "../history"
3
-import { StretchType, Data, Edge, Corner } from "types"
4
-import { getCommonBounds, getPage, getSelectedShapes } from "utils/utils"
5
-import { getShapeUtils } from "lib/shape-utils"
6
-import { current } from "immer"
1
+import Command from './command'
2
+import history from '../history'
3
+import { StretchType, Data, Edge, Corner } from 'types'
4
+import { getCommonBounds, getPage, getSelectedShapes } from 'utils/utils'
5
+import { getShapeUtils } from 'lib/shape-utils'
6
+import { current } from 'immer'
7
 
7
 
8
 export default function stretchCommand(data: Data, type: StretchType) {
8
 export default function stretchCommand(data: Data, type: StretchType) {
9
   const { currentPageId } = data
9
   const { currentPageId } = data
17
   history.execute(
17
   history.execute(
18
     data,
18
     data,
19
     new Command({
19
     new Command({
20
-      name: "stretched",
21
-      category: "canvas",
20
+      name: 'stretched_shapes',
21
+      category: 'canvas',
22
       do(data) {
22
       do(data) {
23
         const { shapes } = getPage(data, currentPageId)
23
         const { shapes } = getPage(data, currentPageId)
24
 
24
 

+ 1
- 2
state/commands/style.ts Переглянути файл

5
   getDocumentBranch,
5
   getDocumentBranch,
6
   getPage,
6
   getPage,
7
   getSelectedIds,
7
   getSelectedIds,
8
-  getSelectedShapes,
9
   setToArray,
8
   setToArray,
10
 } from 'utils/utils'
9
 } from 'utils/utils'
11
 import { getShapeUtils } from 'lib/shape-utils'
10
 import { getShapeUtils } from 'lib/shape-utils'
25
   history.execute(
24
   history.execute(
26
     data,
25
     data,
27
     new Command({
26
     new Command({
28
-      name: 'changed_style',
27
+      name: 'style_shapes',
29
       category: 'canvas',
28
       category: 'canvas',
30
       manualSelection: true,
29
       manualSelection: true,
31
       do(data) {
30
       do(data) {

+ 1
- 1
state/commands/toggle.ts Переглянути файл

19
   history.execute(
19
   history.execute(
20
     data,
20
     data,
21
     new Command({
21
     new Command({
22
-      name: 'toggle_shape_prop',
22
+      name: 'toggle_prop',
23
       category: 'canvas',
23
       category: 'canvas',
24
       do(data) {
24
       do(data) {
25
         const { shapes } = getPage(data, currentPageId)
25
         const { shapes } = getPage(data, currentPageId)

+ 2
- 8
state/commands/transform-single.ts Переглянути файл

1
 import Command from './command'
1
 import Command from './command'
2
 import history from '../history'
2
 import history from '../history'
3
-import { Data, Corner, Edge } from 'types'
4
-import { getShapeUtils } from 'lib/shape-utils'
3
+import { Data } from 'types'
5
 import { current } from 'immer'
4
 import { current } from 'immer'
6
 import { TransformSingleSnapshot } from 'state/sessions/transform-single-session'
5
 import { TransformSingleSnapshot } from 'state/sessions/transform-single-session'
7
-import {
8
-  getPage,
9
-  getSelectedIds,
10
-  setSelectedIds,
11
-  updateParents,
12
-} from 'utils/utils'
6
+import { getPage, setSelectedIds, updateParents } from 'utils/utils'
13
 
7
 
14
 export default function transformSingleCommand(
8
 export default function transformSingleCommand(
15
   data: Data,
9
   data: Data,

+ 1
- 2
state/commands/translate.ts Переглянути файл

1
 import Command from './command'
1
 import Command from './command'
2
 import history from '../history'
2
 import history from '../history'
3
 import { TranslateSnapshot } from 'state/sessions/translate-session'
3
 import { TranslateSnapshot } from 'state/sessions/translate-session'
4
-import { Data, GroupShape, Shape, ShapeType } from 'types'
4
+import { Data, ShapeType } from 'types'
5
 import {
5
 import {
6
   getDocumentBranch,
6
   getDocumentBranch,
7
   getPage,
7
   getPage,
9
   updateParents,
9
   updateParents,
10
 } from 'utils/utils'
10
 } from 'utils/utils'
11
 import { getShapeUtils } from 'lib/shape-utils'
11
 import { getShapeUtils } from 'lib/shape-utils'
12
-import { uniqueId } from 'utils/utils'
13
 
12
 
14
 export default function translateCommand(
13
 export default function translateCommand(
15
   data: Data,
14
   data: Data,

+ 2
- 5
state/commands/ungroup.ts Переглянути файл

1
 import Command from './command'
1
 import Command from './command'
2
 import history from '../history'
2
 import history from '../history'
3
-import { Data, GroupShape, Shape, ShapeType } from 'types'
3
+import { Data, ShapeType } from 'types'
4
 import {
4
 import {
5
-  getCommonBounds,
6
   getPage,
5
   getPage,
7
   getSelectedShapes,
6
   getSelectedShapes,
8
   getShape,
7
   getShape,
9
   setSelectedIds,
8
   setSelectedIds,
10
 } from 'utils/utils'
9
 } from 'utils/utils'
11
 import { current } from 'immer'
10
 import { current } from 'immer'
12
-import { createShape, getShapeUtils } from 'lib/shape-utils'
13
-import { PropsOfType } from 'types'
14
-import { uniqueId } from 'utils/utils'
11
+import { getShapeUtils } from 'lib/shape-utils'
15
 
12
 
16
 export default function ungroupCommand(data: Data) {
13
 export default function ungroupCommand(data: Data) {
17
   const cData = current(data)
14
   const cData = current(data)

Завантаження…
Відмінити
Зберегти