You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

change-page.ts 589B

123456789101112131415161718192021222324
  1. import Command from './command'
  2. import history from '../history'
  3. import { Data } from 'types'
  4. import { getPage, getSelectedShapes } from 'utils/utils'
  5. import { getShapeUtils } from 'lib/shape-utils'
  6. import * as vec from 'utils/vec'
  7. export default function nudgeCommand(data: Data, pageId: string) {
  8. const { currentPageId: prevPageId } = data
  9. history.execute(
  10. data,
  11. new Command({
  12. name: 'change_page',
  13. category: 'canvas',
  14. do(data) {
  15. data.currentPageId = pageId
  16. },
  17. undo(data) {
  18. data.currentPageId = prevPageId
  19. },
  20. })
  21. )
  22. }