preset.ts 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import { Mode, PointInfo, Pos } from "@/sdk/types";
  2. import { stackFactory, Stack, fastStacksValue, os } from "@/utils/vue";
  3. import { Ref, ref } from "vue";
  4. import {FixPoint} from "@/store/fixPoint";
  5. import {BasePoint} from "@/store/basePoint";
  6. export enum DisabledCom {
  7. Search = "search",
  8. TabSwitch = "switch",
  9. MouseMenu = "mouseMenu",
  10. CustomMouseMenu = "cMoseMenu",
  11. ResidenMouseMenu = "rMouseMenu",
  12. Hot = "hot",
  13. HotInfo = "hotInfo",
  14. Measure = "measure",
  15. Map = "map",
  16. Clound = "clound",
  17. Coord = "coord",
  18. Save = "save",
  19. LaserLoading = "laserLoading",
  20. tool = "tool",
  21. floors = "floors",
  22. lmenu = "lmenu",
  23. autoLeave = "autoLeave",
  24. Mode = 'mode',
  25. photo = 'photo'
  26. }
  27. export const searchDisabledStack = stackFactory(ref(false));
  28. export const tabSwitchDisabledStack = stackFactory(ref(false));
  29. export const mouseMenuDisabledStack = stackFactory(ref(false));
  30. export const customMouseMenuDisabledStack = stackFactory(ref(false));
  31. export const residenMouseMenuDisapbedStack = stackFactory(ref(false));
  32. export const hotDisabledStack = stackFactory(ref(false));
  33. export const hotInfoDisabledStack = stackFactory(ref(false));
  34. export const measureDisabledStack = stackFactory(ref(true));
  35. export const mapDisabledStack = stackFactory(ref(true));
  36. export const cloundDisabledStack = stackFactory(ref(false));
  37. export const coordDisabledStack = stackFactory(ref(true));
  38. export const saveDisabledStack = stackFactory(ref(false));
  39. export const laserLoadingDisabled = stackFactory(ref(true));
  40. export const toolDisabled = stackFactory(ref(false));
  41. export const floorsDisabled = stackFactory(ref(false));
  42. export const lmenuDisabled = stackFactory(ref(false));
  43. export const autoLeaveDisabled = stackFactory(ref(false));
  44. export const modeDisabled = stackFactory(ref(false));
  45. export const photoDisabled= stackFactory(ref(false));
  46. export const disabledMapStack = {
  47. [DisabledCom.Search]: searchDisabledStack,
  48. [DisabledCom.TabSwitch]: tabSwitchDisabledStack,
  49. [DisabledCom.MouseMenu]: mouseMenuDisabledStack,
  50. [DisabledCom.ResidenMouseMenu]: residenMouseMenuDisapbedStack,
  51. [DisabledCom.CustomMouseMenu]: customMouseMenuDisabledStack,
  52. [DisabledCom.Hot]: hotDisabledStack,
  53. [DisabledCom.Measure]: measureDisabledStack,
  54. [DisabledCom.Map]: mapDisabledStack,
  55. [DisabledCom.Clound]: cloundDisabledStack,
  56. [DisabledCom.Coord]: coordDisabledStack,
  57. [DisabledCom.Save]: saveDisabledStack,
  58. [DisabledCom.LaserLoading]: laserLoadingDisabled,
  59. [DisabledCom.HotInfo]: hotInfoDisabledStack,
  60. [DisabledCom.HotInfo]: hotInfoDisabledStack,
  61. [DisabledCom.tool]: toolDisabled,
  62. [DisabledCom.floors]: floorsDisabled,
  63. [DisabledCom.lmenu]: lmenuDisabled,
  64. [DisabledCom.autoLeave]: autoLeaveDisabled,
  65. [DisabledCom.Mode]: modeDisabled,
  66. [DisabledCom.photo]: photoDisabled,
  67. } as { [key in DisabledCom]: Stack<Ref<boolean>> };
  68. export type DisabledMapStack = typeof disabledMapStack;
  69. export const disabledMap = fastStacksValue(disabledMapStack);
  70. export enum CustomCom {
  71. LaserMode = "mode",
  72. FullView = "full",
  73. SpiltView = "split",
  74. MagnifierMode = "magnifier",
  75. CustomMouseMenu = "cMoseMenu",
  76. ActiveFixPoint = "activeFixPoint",
  77. ActiveBasePoint = "activeBasePoint",
  78. ResidenMouseMenu = "rMouseMenu",
  79. CarryView = "carryView",
  80. SysView = "sysView",
  81. boxWidth = "boxWidth",
  82. autoMarginLeft = "autoMarginLeft",
  83. fullCtrl = "fullCtrl",
  84. }
  85. export enum RightMenuEum {
  86. NavStart = "NavStart",
  87. NavEnd = "NavEnd",
  88. MeasureStart = "MeasureStart",
  89. AddHot = "AddHot",
  90. DownClund = "DownClund",
  91. }
  92. export type RightMenuAtom = {
  93. key?: RightMenuEum | string;
  94. icon: string;
  95. label: string;
  96. color?: string;
  97. custDisabled?: boolean;
  98. mapDisabled?: boolean;
  99. sceneDisabled?: boolean;
  100. disabled?: boolean;
  101. click: (pos: PointInfo, screen: Pos, inMap: boolean) => void;
  102. };
  103. export type RightMenus = Array<RightMenuAtom>;
  104. export type FullViewMode = "scene" | "map";
  105. export type CarryViewMode = "full" | "auto" | "auto not-left";
  106. export type SysViewMode = "full" | "auto";
  107. export const laserModeStack = stackFactory(ref<Mode>(Mode.pano));
  108. export const fullViewStack = stackFactory(ref<FullViewMode>("scene"));
  109. export const spiltViewModeStack = stackFactory(ref<number>(null));
  110. export const magnifierModeStack = stackFactory(ref<boolean>(false));
  111. export const residenMouseMenuStack = stackFactory(ref<RightMenus>([]));
  112. export const customMouseMenuStack = stackFactory(ref<RightMenus>([]));
  113. export const carryViewStack = stackFactory(ref<CarryViewMode>("full"));
  114. export const sysViewStack = stackFactory(ref<SysViewMode>("auto"));
  115. export const boxWidthStack = stackFactory(
  116. ref<string>(os.isPc ? "" : "calc(100% - var(--editor-menu-width))")
  117. );
  118. export const autoSysViewLeftStack = stackFactory(ref<string>("70px"));
  119. export const controlFullStack = stackFactory(ref<boolean>(false));
  120. export const activeFixPointStack = stackFactory(ref<FixPoint>());
  121. export const activeBasePointStack = stackFactory(ref<BasePoint>());
  122. export const customMapStack = {
  123. [CustomCom.LaserMode]: laserModeStack,
  124. [CustomCom.FullView]: fullViewStack,
  125. [CustomCom.SpiltView]: spiltViewModeStack,
  126. [CustomCom.ActiveFixPoint]: activeFixPointStack,
  127. [CustomCom.ActiveBasePoint]: activeBasePointStack,
  128. [CustomCom.MagnifierMode]: magnifierModeStack,
  129. [CustomCom.ResidenMouseMenu]: residenMouseMenuStack,
  130. [CustomCom.CustomMouseMenu]: customMouseMenuStack,
  131. [CustomCom.CarryView]: carryViewStack,
  132. [CustomCom.SysView]: sysViewStack,
  133. [CustomCom.boxWidth]: boxWidthStack,
  134. [CustomCom.autoMarginLeft]: autoSysViewLeftStack,
  135. [CustomCom.fullCtrl]: controlFullStack,
  136. };
  137. export type CustomMapStack = typeof customMapStack;
  138. export const customMap = fastStacksValue(customMapStack);