Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import Command from './command'
  2. import history from '../history'
  3. import { Data } from 'types'
  4. import { getPage } from 'utils/utils'
  5. import { ArrowSnapshot } from 'state/sessions/arrow-session'
  6. export default function arrowCommand(
  7. data: Data,
  8. before: ArrowSnapshot,
  9. after: ArrowSnapshot
  10. ) {
  11. history.execute(
  12. data,
  13. new Command({
  14. name: 'point_arrow',
  15. category: 'canvas',
  16. manualSelection: true,
  17. do(data, isInitial) {
  18. if (isInitial) return
  19. const { initialShape, currentPageId } = after
  20. const page = getPage(data, currentPageId)
  21. page.shapes[initialShape.id] = initialShape
  22. data.selectedIds.clear()
  23. data.selectedIds.add(initialShape.id)
  24. data.hoveredId = undefined
  25. data.pointedId = undefined
  26. },
  27. undo(data) {
  28. const { initialShape, currentPageId } = before
  29. const shapes = getPage(data, currentPageId).shapes
  30. delete shapes[initialShape.id]
  31. data.selectedIds.clear()
  32. data.hoveredId = undefined
  33. data.pointedId = undefined
  34. },
  35. })
  36. )
  37. }