Update tag names
This commit is contained in:
parent
76008bb8cd
commit
6729435696
20 changed files with 32 additions and 46 deletions
|
@ -11,7 +11,7 @@ export default function createPage(data: Data, goToPage = true) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'change_page',
|
name: 'create_page',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { page, pageState, currentPageId } = snapshot
|
const { page, pageState, currentPageId } = snapshot
|
||||||
|
|
|
@ -2,18 +2,16 @@ import Command from './command'
|
||||||
import history from '../history'
|
import history from '../history'
|
||||||
import { Data } from 'types'
|
import { Data } from 'types'
|
||||||
import { current } from 'immer'
|
import { current } from 'immer'
|
||||||
import { getPage, getSelectedShapes } from 'utils/utils'
|
|
||||||
import { getShapeUtils } from 'lib/shape-utils'
|
|
||||||
import vec from 'utils/vec'
|
import vec from 'utils/vec'
|
||||||
import storage from 'state/storage'
|
import storage from 'state/storage'
|
||||||
|
|
||||||
export default function changePage(data: Data, pageId: string) {
|
export default function deletePage(data: Data, pageId: string) {
|
||||||
const snapshot = getSnapshot(data, pageId)
|
const snapshot = getSnapshot(data, pageId)
|
||||||
|
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'change_page',
|
name: 'delete_page',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
data.currentPageId = snapshot.nextPageId
|
data.currentPageId = snapshot.nextPageId
|
||||||
|
|
|
@ -37,7 +37,7 @@ export default function deleteSelected(data: Data) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'delete_shapes',
|
name: 'delete_selection',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
manualSelection: true,
|
manualSelection: true,
|
||||||
do(data) {
|
do(data) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default function distributeCommand(data: Data, type: DistributeType) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'distributed',
|
name: 'distribute_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data, currentPageId)
|
const { shapes } = getPage(data, currentPageId)
|
||||||
|
|
|
@ -19,6 +19,7 @@ export default function duplicateCommand(data: Data) {
|
||||||
...shape,
|
...shape,
|
||||||
id: uniqueId(),
|
id: uniqueId(),
|
||||||
point: vec.add(shape.point, vec.div([16, 16], getCurrentCamera(data).zoom)),
|
point: vec.add(shape.point, vec.div([16, 16], getCurrentCamera(data).zoom)),
|
||||||
|
isGenerated: false,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
history.execute(
|
history.execute(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import Command from './command'
|
import Command from './command'
|
||||||
import history from '../history'
|
import history from '../history'
|
||||||
import { Data } from 'types'
|
import { Data } from 'types'
|
||||||
import { getPage, getShape } from 'utils/utils'
|
import { getPage } from 'utils/utils'
|
||||||
import { EditSnapshot } from 'state/sessions/edit-session'
|
import { EditSnapshot } from 'state/sessions/edit-session'
|
||||||
import { getShapeUtils } from 'lib/shape-utils'
|
import { getShapeUtils } from 'lib/shape-utils'
|
||||||
|
|
||||||
export default function handleCommand(
|
export default function editCommand(
|
||||||
data: Data,
|
data: Data,
|
||||||
before: EditSnapshot,
|
before: EditSnapshot,
|
||||||
after: EditSnapshot
|
after: EditSnapshot
|
||||||
|
@ -13,7 +13,7 @@ export default function handleCommand(
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'edited_shape',
|
name: 'edit_shape',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { initialShape, currentPageId } = after
|
const { initialShape, currentPageId } = after
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default function generateCommand(
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'translate_shapes',
|
name: 'generate_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data)
|
const { shapes } = getPage(data)
|
||||||
|
|
|
@ -11,8 +11,6 @@ import {
|
||||||
} from 'utils/utils'
|
} from 'utils/utils'
|
||||||
import { current } from 'immer'
|
import { current } from 'immer'
|
||||||
import { createShape, getShapeUtils } from 'lib/shape-utils'
|
import { createShape, getShapeUtils } from 'lib/shape-utils'
|
||||||
import { PropsOfType } from 'types'
|
|
||||||
import { uniqueId } from 'utils/utils'
|
|
||||||
import commands from '.'
|
import commands from '.'
|
||||||
|
|
||||||
export default function groupCommand(data: Data) {
|
export default function groupCommand(data: Data) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { getShapeUtils } from 'lib/shape-utils'
|
||||||
import vec from 'utils/vec'
|
import vec from 'utils/vec'
|
||||||
import storage from 'state/storage'
|
import storage from 'state/storage'
|
||||||
|
|
||||||
export default function nudgeCommand(data: Data, newPageId: string) {
|
export default function moveToPageCommand(data: Data, newPageId: string) {
|
||||||
const { currentPageId: oldPageId } = data
|
const { currentPageId: oldPageId } = data
|
||||||
const oldPage = getPage(data)
|
const oldPage = getPage(data)
|
||||||
const selectedIds = setToArray(getSelectedIds(data))
|
const selectedIds = setToArray(getSelectedIds(data))
|
||||||
|
@ -35,7 +35,7 @@ export default function nudgeCommand(data: Data, newPageId: string) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'set_direction',
|
name: 'move_to_page',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
manualSelection: true,
|
manualSelection: true,
|
||||||
do(data) {
|
do(data) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default function moveCommand(data: Data, type: MoveType) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'move_shapes',
|
name: 'change_child_index',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
manualSelection: true,
|
manualSelection: true,
|
||||||
do(data) {
|
do(data) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default function nudgeCommand(data: Data, delta: number[]) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'set_direction',
|
name: 'nudge_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data, currentPageId)
|
const { shapes } = getPage(data, currentPageId)
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default function pasteCommand(data: Data, initialShapes: Shape[]) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'pasting_new_shapes',
|
name: 'paste_new_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
manualSelection: true,
|
manualSelection: true,
|
||||||
do(data) {
|
do(data) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default function rotateCcwCommand(data: Data) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'translate_shapes',
|
name: 'rotate_ccw',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data, currentPageId)
|
const { shapes } = getPage(data, currentPageId)
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default function rotateCommand(
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'translate_shapes',
|
name: 'rotate_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data)
|
const { shapes } = getPage(data)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Command from "./command"
|
import Command from './command'
|
||||||
import history from "../history"
|
import history from '../history'
|
||||||
import { StretchType, Data, Edge, Corner } from "types"
|
import { StretchType, Data, Edge, Corner } from 'types'
|
||||||
import { getCommonBounds, getPage, getSelectedShapes } from "utils/utils"
|
import { getCommonBounds, getPage, getSelectedShapes } from 'utils/utils'
|
||||||
import { getShapeUtils } from "lib/shape-utils"
|
import { getShapeUtils } from 'lib/shape-utils'
|
||||||
import { current } from "immer"
|
import { current } from 'immer'
|
||||||
|
|
||||||
export default function stretchCommand(data: Data, type: StretchType) {
|
export default function stretchCommand(data: Data, type: StretchType) {
|
||||||
const { currentPageId } = data
|
const { currentPageId } = data
|
||||||
|
@ -17,8 +17,8 @@ export default function stretchCommand(data: Data, type: StretchType) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: "stretched",
|
name: 'stretched_shapes',
|
||||||
category: "canvas",
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data, currentPageId)
|
const { shapes } = getPage(data, currentPageId)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
getDocumentBranch,
|
getDocumentBranch,
|
||||||
getPage,
|
getPage,
|
||||||
getSelectedIds,
|
getSelectedIds,
|
||||||
getSelectedShapes,
|
|
||||||
setToArray,
|
setToArray,
|
||||||
} from 'utils/utils'
|
} from 'utils/utils'
|
||||||
import { getShapeUtils } from 'lib/shape-utils'
|
import { getShapeUtils } from 'lib/shape-utils'
|
||||||
|
@ -25,7 +24,7 @@ export default function styleCommand(data: Data, styles: Partial<ShapeStyles>) {
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'changed_style',
|
name: 'style_shapes',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
manualSelection: true,
|
manualSelection: true,
|
||||||
do(data) {
|
do(data) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default function toggleCommand(
|
||||||
history.execute(
|
history.execute(
|
||||||
data,
|
data,
|
||||||
new Command({
|
new Command({
|
||||||
name: 'toggle_shape_prop',
|
name: 'toggle_prop',
|
||||||
category: 'canvas',
|
category: 'canvas',
|
||||||
do(data) {
|
do(data) {
|
||||||
const { shapes } = getPage(data, currentPageId)
|
const { shapes } = getPage(data, currentPageId)
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
import Command from './command'
|
import Command from './command'
|
||||||
import history from '../history'
|
import history from '../history'
|
||||||
import { Data, Corner, Edge } from 'types'
|
import { Data } from 'types'
|
||||||
import { getShapeUtils } from 'lib/shape-utils'
|
|
||||||
import { current } from 'immer'
|
import { current } from 'immer'
|
||||||
import { TransformSingleSnapshot } from 'state/sessions/transform-single-session'
|
import { TransformSingleSnapshot } from 'state/sessions/transform-single-session'
|
||||||
import {
|
import { getPage, setSelectedIds, updateParents } from 'utils/utils'
|
||||||
getPage,
|
|
||||||
getSelectedIds,
|
|
||||||
setSelectedIds,
|
|
||||||
updateParents,
|
|
||||||
} from 'utils/utils'
|
|
||||||
|
|
||||||
export default function transformSingleCommand(
|
export default function transformSingleCommand(
|
||||||
data: Data,
|
data: Data,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Command from './command'
|
import Command from './command'
|
||||||
import history from '../history'
|
import history from '../history'
|
||||||
import { TranslateSnapshot } from 'state/sessions/translate-session'
|
import { TranslateSnapshot } from 'state/sessions/translate-session'
|
||||||
import { Data, GroupShape, Shape, ShapeType } from 'types'
|
import { Data, ShapeType } from 'types'
|
||||||
import {
|
import {
|
||||||
getDocumentBranch,
|
getDocumentBranch,
|
||||||
getPage,
|
getPage,
|
||||||
|
@ -9,7 +9,6 @@ import {
|
||||||
updateParents,
|
updateParents,
|
||||||
} from 'utils/utils'
|
} from 'utils/utils'
|
||||||
import { getShapeUtils } from 'lib/shape-utils'
|
import { getShapeUtils } from 'lib/shape-utils'
|
||||||
import { uniqueId } from 'utils/utils'
|
|
||||||
|
|
||||||
export default function translateCommand(
|
export default function translateCommand(
|
||||||
data: Data,
|
data: Data,
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
import Command from './command'
|
import Command from './command'
|
||||||
import history from '../history'
|
import history from '../history'
|
||||||
import { Data, GroupShape, Shape, ShapeType } from 'types'
|
import { Data, ShapeType } from 'types'
|
||||||
import {
|
import {
|
||||||
getCommonBounds,
|
|
||||||
getPage,
|
getPage,
|
||||||
getSelectedShapes,
|
getSelectedShapes,
|
||||||
getShape,
|
getShape,
|
||||||
setSelectedIds,
|
setSelectedIds,
|
||||||
} from 'utils/utils'
|
} from 'utils/utils'
|
||||||
import { current } from 'immer'
|
import { current } from 'immer'
|
||||||
import { createShape, getShapeUtils } from 'lib/shape-utils'
|
import { getShapeUtils } from 'lib/shape-utils'
|
||||||
import { PropsOfType } from 'types'
|
|
||||||
import { uniqueId } from 'utils/utils'
|
|
||||||
|
|
||||||
export default function ungroupCommand(data: Data) {
|
export default function ungroupCommand(data: Data) {
|
||||||
const cData = current(data)
|
const cData = current(data)
|
||||||
|
|
Loading…
Reference in a new issue