|
@@ -18,6 +18,10 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
import ButtonPane from "@/components/button-pane/index.vue";
|
|
import ButtonPane from "@/components/button-pane/index.vue";
|
|
|
|
+import {list} from '@/store/measure'
|
|
|
|
+import {fixPoints} from '@/store/fixPoint'
|
|
|
|
+import {baseLines} from '@/store/baseLine'
|
|
|
|
+import {basePoints} from '@/store/basePoint'
|
|
import {photos} from '@/store/photos'
|
|
import {photos} from '@/store/photos'
|
|
import { useSDK } from '@/hook/useLaser'
|
|
import { useSDK } from '@/hook/useLaser'
|
|
import {genUseLoading} from "@/hook";
|
|
import {genUseLoading} from "@/hook";
|
|
@@ -26,15 +30,28 @@ import {nextTick, ref} from "vue";
|
|
import {getStaticFile} from '@/dbo/main'
|
|
import {getStaticFile} from '@/dbo/main'
|
|
import {uploadImage} from "@/store/sync";
|
|
import {uploadImage} from "@/store/sync";
|
|
import {router, writeRouteName} from "@/router";
|
|
import {router, writeRouteName} from "@/router";
|
|
|
|
+import {Pos, Pos3D} from "@/sdk";
|
|
|
|
|
|
const showCoverUrl = ref<string>(
|
|
const showCoverUrl = ref<string>(
|
|
photos.value[photos.value.length - 1]?.url && getStaticFile(photos.value[photos.value.length - 1]?.url)
|
|
photos.value[photos.value.length - 1]?.url && getStaticFile(photos.value[photos.value.length - 1]?.url)
|
|
)
|
|
)
|
|
const tempPhoto = ref<string>();
|
|
const tempPhoto = ref<string>();
|
|
const coverRef = ref<HTMLImageElement>()
|
|
const coverRef = ref<HTMLImageElement>()
|
|
|
|
+const getCurrentScreens = (poss: Array<Pos3D>): Array<Pos> => {
|
|
|
|
+ console.log(poss)
|
|
|
|
+ const sdk = useSDK()
|
|
|
|
+ return poss
|
|
|
|
+ .map(pos => {
|
|
|
|
+ const data = sdk.scene.getScreenByPoint(pos)
|
|
|
|
+ return data.trueSide ? data.pos : null
|
|
|
|
+ })
|
|
|
|
+ .filter(pos => !!pos);
|
|
|
|
+}
|
|
const photo = genUseLoading(async () => {
|
|
const photo = genUseLoading(async () => {
|
|
const sdk = useSDK()
|
|
const sdk = useSDK()
|
|
const dom = sdk.scene.el
|
|
const dom = sdk.scene.el
|
|
|
|
+ dom.style.pointerEvents = "none"
|
|
|
|
+
|
|
const {dataUrl: base64} = await sdk.scene.screenshot(dom.offsetWidth, dom.offsetHeight)
|
|
const {dataUrl: base64} = await sdk.scene.screenshot(dom.offsetWidth, dom.offsetHeight)
|
|
const blob = base64ToBlob(base64)
|
|
const blob = base64ToBlob(base64)
|
|
tempPhoto.value = URL.createObjectURL(blob)
|
|
tempPhoto.value = URL.createObjectURL(blob)
|
|
@@ -45,13 +62,23 @@ const photo = genUseLoading(async () => {
|
|
coverRef.value.removeEventListener("animationend", handler)
|
|
coverRef.value.removeEventListener("animationend", handler)
|
|
showCoverUrl.value = tempPhoto.value
|
|
showCoverUrl.value = tempPhoto.value
|
|
tempPhoto.value = null
|
|
tempPhoto.value = null
|
|
|
|
+
|
|
upload.then(url => {
|
|
upload.then(url => {
|
|
photos.value.push({
|
|
photos.value.push({
|
|
id: getId(),
|
|
id: getId(),
|
|
url: url,
|
|
url: url,
|
|
- time: new Date().getTime()
|
|
|
|
|
|
+ time: new Date().getTime(),
|
|
|
|
+ measures: list.value
|
|
|
|
+ .map(data => getCurrentScreens(data.points))
|
|
|
|
+ .filter(poss => poss.length),
|
|
|
|
+ baseLines: baseLines.value
|
|
|
|
+ .map(data => getCurrentScreens(data.points))
|
|
|
|
+ .filter(poss => poss.length),
|
|
|
|
+ fixPoints: getCurrentScreens(fixPoints.value.map(data => data.pos)),
|
|
|
|
+ basePoints: getCurrentScreens(basePoints.value.map(data => data.pos))
|
|
})
|
|
})
|
|
showCoverUrl.value = getStaticFile(url)
|
|
showCoverUrl.value = getStaticFile(url)
|
|
|
|
+ dom.style.pointerEvents = "all"
|
|
})
|
|
})
|
|
}
|
|
}
|
|
coverRef.value.addEventListener("animationend", handler)
|
|
coverRef.value.addEventListener("animationend", handler)
|