|
@@ -1,34 +1,33 @@
|
|
|
<template>
|
|
|
<div class="canvas-layout">
|
|
|
- <p v-if="currentMeterPerPixel" class="meterPerPixel">1: {{currentMeterPerPixel}}</p>
|
|
|
+ <p v-if="currentMeterPerPixel" class="meterPerPixel">1: {{ currentMeterPerPixel }}</p>
|
|
|
<div class="scene-canvas" ref="sceneLayoutRef" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import {onActivated, onDeactivated, onMounted, ref, watchEffect} from "vue";
|
|
|
-import {customMap, disabledMap, setupLaser, useLoading, useParams} from "@/hook";
|
|
|
-import {store} from "@/store";
|
|
|
-import {currentApp} from "@/store/app";
|
|
|
-import {Loading} from '@kankan/components/index'
|
|
|
-import {LaserSDK, Mode} from "@/sdk";
|
|
|
-import {api} from "@/store/sync";
|
|
|
-
|
|
|
-const emit = defineEmits<{ (e: 'loaded'): void }>()
|
|
|
+import { onActivated, onDeactivated, onMounted, ref, watchEffect } from "vue";
|
|
|
+import { customMap, disabledMap, setupLaser, useLoading, useParams } from "@/hook";
|
|
|
+import { store } from "@/store";
|
|
|
+import { currentApp } from "@/store/app";
|
|
|
+import { Loading } from "@kankan/components/index";
|
|
|
+import { LaserSDK, Mode } from "@/sdk";
|
|
|
+import { api } from "@/store/sync";
|
|
|
+
|
|
|
+const emit = defineEmits<{ (e: "loaded"): void }>();
|
|
|
const sceneLayoutRef = ref<HTMLCanvasElement>();
|
|
|
-const active = ref(true)
|
|
|
+const active = ref(true);
|
|
|
|
|
|
-onActivated(() => active.value = true)
|
|
|
-onDeactivated(() => active.value = false)
|
|
|
+onActivated(() => (active.value = true));
|
|
|
+onDeactivated(() => (active.value = false));
|
|
|
|
|
|
const handlerSDK = (sdk: LaserSDK) => {
|
|
|
watchEffect(() => {
|
|
|
- console.log("visible", active.value)
|
|
|
- sdk.scene.emit("visible", active.value)
|
|
|
- })
|
|
|
-}
|
|
|
+ sdk.scene.emit("visible", active.value);
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
-const currentMeterPerPixel = ref(0)
|
|
|
+const currentMeterPerPixel = ref(0);
|
|
|
|
|
|
onMounted(async () => {
|
|
|
const sdk = await useLoading(
|
|
@@ -44,47 +43,48 @@ onMounted(async () => {
|
|
|
})
|
|
|
);
|
|
|
|
|
|
- emit('loaded')
|
|
|
+ emit("loaded");
|
|
|
|
|
|
- sdk.scene.on('posChange', pos => {
|
|
|
- currentMeterPerPixel.value = pos.meterPerPixel ? Math.round(1 / pos.meterPerPixel) : null
|
|
|
- })
|
|
|
+ sdk.scene.on("posChange", (pos) => {
|
|
|
+ currentMeterPerPixel.value = pos.meterPerPixel
|
|
|
+ ? Math.round(1 / pos.meterPerPixel)
|
|
|
+ : null;
|
|
|
+ });
|
|
|
// 156 170
|
|
|
// 90
|
|
|
setTimeout(() => {
|
|
|
watchEffect(() => {
|
|
|
- const doms = Array.from(sceneLayoutRef.value.querySelectorAll("#navCube, #home")) as HTMLElement[]
|
|
|
+ const doms = Array.from(
|
|
|
+ sceneLayoutRef.value.querySelectorAll("#navCube, #home")
|
|
|
+ ) as HTMLElement[];
|
|
|
if (!disabledMap.mode) {
|
|
|
if (customMap.mode === Mode.pano) {
|
|
|
- doms.forEach(dom => {
|
|
|
- dom.style.display = "none"
|
|
|
- })
|
|
|
+ doms.forEach((dom) => {
|
|
|
+ dom.style.display = "none";
|
|
|
+ });
|
|
|
} else {
|
|
|
- doms.forEach(dom => {
|
|
|
- dom.style.display = "block"
|
|
|
- })
|
|
|
+ doms.forEach((dom) => {
|
|
|
+ dom.style.display = "block";
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- handlerSDK(sdk)
|
|
|
- })
|
|
|
- Loading.hideAll()
|
|
|
- }, 1000)
|
|
|
+ handlerSDK(sdk);
|
|
|
+ });
|
|
|
+ Loading.hideAll();
|
|
|
+ }, 1000);
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.canvas-layout {
|
|
|
- width : 100%;
|
|
|
- height : 100%;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
position: relative;
|
|
|
z-index: 0;
|
|
|
}
|
|
|
|
|
|
.scene-canvas {
|
|
|
- width : 100%;
|
|
|
+ width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
@@ -96,10 +96,9 @@ onMounted(async () => {
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-.canvas-layout {
|
|
|
-
|
|
|
+.canvas-layout {
|
|
|
.meterPerPixel,
|
|
|
- #navCube{
|
|
|
+ #navCube {
|
|
|
position: absolute !important;
|
|
|
right: calc(var(--boundMargin) + 10px) !important;
|
|
|
top: calc(var(--boundMargin) + 10px) !important;
|
|
@@ -122,7 +121,7 @@ onMounted(async () => {
|
|
|
background: none !important;
|
|
|
z-index: 2;
|
|
|
color: #fff;
|
|
|
- transition: all .3s ease;
|
|
|
+ transition: all 0.3s ease;
|
|
|
|
|
|
&:before {
|
|
|
content: "\e73e";
|
|
@@ -144,8 +143,7 @@ onMounted(async () => {
|
|
|
font-weight: 400;
|
|
|
line-height: 23px;
|
|
|
font-size: 20px;
|
|
|
- text-shadow: 0px 1px 0px rgba(0,0,0,0.5);
|
|
|
+ text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</style>
|