setting.ts 792 B

123456789101112131415161718192021222324252627
  1. import { setting } from "@/store";
  2. import { nextTick, watchEffect } from "vue";
  3. import { SDK } from "../sdk";
  4. import { analysisPoseInfo } from ".";
  5. export const associationSetting = (sdk: SDK, mountEl: HTMLDivElement) => {
  6. watchEffect(() => {
  7. setting.value?.fov && sdk.setCameraFov(setting.value.fov);
  8. });
  9. const stopWatchPose = watchEffect(() => {
  10. if (!setting.value?.pose) return;
  11. if (sdk.setPose) {
  12. sdk.setPose(analysisPoseInfo(setting.value.pose))
  13. } else {
  14. sdk.comeTo(setting.value.pose);
  15. }
  16. nextTick(() => stopWatchPose());
  17. });
  18. watchEffect(() => {
  19. if (setting.value) {
  20. const direEl = document.querySelector("#direction") as HTMLDivElement;
  21. direEl.style.display = setting.value.openCompass ? "block" : "none";
  22. }
  23. });
  24. };