state.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { number } from "vue-types";
  2. const CONST = {
  3. MODE_SEL_RECT: 1,
  4. MODE_MOVING: 2,
  5. MODE_ROTATE: 3,
  6. MODE_SCALE_WIDTH: 4,
  7. MODE_SCALE_SCALE: 5,
  8. MODE_RULER_LINE: 6,
  9. MODE_RULER_DRAG: 7,
  10. MODE_NONE: 0,
  11. };
  12. const downOptions = {
  13. _mouseDownTimestamp: Date.now(),
  14. _state: CONST.MODE_NONE,
  15. _downClientX: 0,
  16. _downClientY: 0,
  17. _downed: false,
  18. _mouseDownFlag: "",
  19. };
  20. const moveOptions = {
  21. _movePreClientY: 0,
  22. _movePreClientX: 0,
  23. _initMovePos: {x: -1, y: -1},
  24. }
  25. const rotateOptions = {
  26. rotateCenter: undefined as any,// {x: 0, y: 0}
  27. ratatePre: 0,
  28. lastRad: 0,
  29. rotateCmd: false,
  30. objinitAngleRad: 0,
  31. }
  32. const scaleOptions = {
  33. scalePivot: undefined as any,
  34. scaleIndex: -1,
  35. mainAxisVector: {x: 0, y: 0},
  36. initScale: {x: 1, y: 1},
  37. initScaleWith: {w: 0, h: 0},
  38. mainAxisVectorLenth: 0,
  39. xAxisVector:{x: 1, y: 1},
  40. xAxisVectorLength: 0,
  41. yAxisVector: {x: 1, y: 1},
  42. yAxisVectorLength: 0,
  43. scaleCmd: false,
  44. lastScale: {x:1, y: 1},
  45. }
  46. export { downOptions , CONST, moveOptions, rotateOptions, scaleOptions};