Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

double-point-handle.ts 865B

123456789101112131415161718192021222324252627282930313233
  1. import Command from './command'
  2. import history from '../history'
  3. import { Data, PointerInfo } from 'types'
  4. import { getShapeUtils } from 'state/shape-utils'
  5. import { deepClone, getPage, getShape, updateParents } from 'utils'
  6. export default function doublePointHandleCommand(
  7. data: Data,
  8. id: string,
  9. payload: PointerInfo
  10. ): void {
  11. const initialShape = deepClone(getShape(data, id))
  12. history.execute(
  13. data,
  14. new Command({
  15. name: 'double_point_handle',
  16. category: 'canvas',
  17. do(data) {
  18. const { shapes } = getPage(data)
  19. const shape = shapes[id]
  20. getShapeUtils(shape).onDoublePointHandle(shape, payload.target, payload)
  21. updateParents(data, [id])
  22. },
  23. undo(data) {
  24. const { shapes } = getPage(data)
  25. shapes[id] = initialShape
  26. updateParents(data, [id])
  27. },
  28. })
  29. )
  30. }