funds.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { useDraw } from "../use-draw.ts";
  2. export const revoke = () => {
  3. }
  4. export const recover = () => {
  5. }
  6. export const clear = () => {
  7. }
  8. export const rotate = () => {
  9. }
  10. export const full = () => {
  11. }
  12. export const aiImport = () => {
  13. }
  14. export const setBGImage = () => {
  15. }
  16. export const gotoVR = () => {
  17. }
  18. export const saveData = () => {
  19. }
  20. export const exportData = () => {
  21. }
  22. export const gotoDrawing = () => {
  23. }
  24. import bgImage from '../../assets/WX20241031-111850.png'
  25. export const useHeaderFunds = () => {
  26. const draw = useDraw()
  27. const setBGImage = () => {
  28. draw.value!.addShape('image', { url: bgImage, width: 1, height: 1 }, {x: window.innerWidth / 2, y: window.innerHeight / 2}, true );
  29. }
  30. const toggleHit = () => {
  31. draw.value?.toggleHit()
  32. }
  33. const describes = new Map<Function, { name: string, icon: string }>([
  34. [revoke, {name: '撤销', icon: ''}],
  35. [recover, {name: '撤销', icon: ''}],
  36. [rotate, {name: '旋转', icon: ''}],
  37. [clear, {name: '清除', icon: ''}],
  38. [full, {name: '全屏', icon: ''}],
  39. [aiImport, {name: 'ai导入', icon: ''}],
  40. [
  41. setBGImage,
  42. {name: '背景图', icon: ''}
  43. ],
  44. [gotoVR, {name: 'VR', icon: ''}],
  45. [saveData, {name: '保存', icon: ''}],
  46. [exportData, {name: '导出', icon: ''}],
  47. [gotoDrawing, {name: '图纸', icon: ''}],
  48. ])
  49. if (import.meta.env.DEV) {
  50. describes.set(toggleHit, {name: '显示hit', icon: ''})
  51. }
  52. return {
  53. revoke,
  54. recover,
  55. rotate,
  56. clear,
  57. full,
  58. aiImport,
  59. setBGImage,
  60. gotoVR,
  61. saveData,
  62. exportData,
  63. gotoDrawing,
  64. toggleHit,
  65. describes,
  66. }
  67. }