|
@@ -61,6 +61,8 @@ import Login from './Login'
|
|
|
import CopyLink from './CopyLink'
|
|
|
import sync from '@/utils/sync'
|
|
|
import { useI18n, getLocale } from '@/i18n'
|
|
|
+import math from "@/utils/math.js";
|
|
|
+
|
|
|
const { t } = useI18n({ useScope: 'global' })
|
|
|
const props = defineProps({
|
|
|
project: Object,
|
|
@@ -102,22 +104,23 @@ const creatAvatar = head => {
|
|
|
}
|
|
|
const getCurPosInfo = () => {
|
|
|
let app = sync.sourceInst
|
|
|
- let id
|
|
|
+ let pos1
|
|
|
if (app.sceneType == 'laser') {
|
|
|
- id = app.viewer.images360.currentPano.id
|
|
|
+ pos1 = app.viewer.images360.position
|
|
|
} else {
|
|
|
- id = app.app.core.get('Player').currentPano.id
|
|
|
+ pos1 = app.app.core.get('Player').currentPano.position
|
|
|
}
|
|
|
let info = sync.targetInst.viewer.getCameraStatus()
|
|
|
- let position = info.position
|
|
|
- return { id, position }
|
|
|
+ let pos2 = info.position
|
|
|
+ return { pos1, pos2 }
|
|
|
+}
|
|
|
+const ifSame = (p1,p2)=>{
|
|
|
+ return p1 && p2 && (math.closeTo(p1.pos1, p2.pos1, 0.1) || math.closeTo(p1.pos2, p2.pos2, 0.1));
|
|
|
}
|
|
|
|
|
|
const onSetP1 = () => {
|
|
|
let p1 = getCurPosInfo()
|
|
|
- if (points.value.p2 && points.value.p2.id == p1.id) {
|
|
|
- return (showTips.value = t('header.setPointfaidText'))
|
|
|
- }
|
|
|
+ if(ifSame(p1, points.value.p2)) return (showTips.value = t('header.setPointfaidText'))
|
|
|
if (points.value.p1) {
|
|
|
showTips.value = t('header.pointUpdate')
|
|
|
}
|
|
@@ -126,9 +129,7 @@ const onSetP1 = () => {
|
|
|
}
|
|
|
const onSetP2 = () => {
|
|
|
let p2 = getCurPosInfo()
|
|
|
- if (points.value.p1 && points.value.p1.id == p2.id) {
|
|
|
- return (showTips.value = t('header.setPointfaidText'))
|
|
|
- }
|
|
|
+ if(ifSame(points.value.p1, p2)) return (showTips.value = t('header.setPointfaidText'))
|
|
|
if (points.value.p2) {
|
|
|
showTips.value = t('header.pointUpdate')
|
|
|
}
|