|
@@ -5,12 +5,25 @@
|
|
<PositionSign
|
|
<PositionSign
|
|
v-for="(position, i) in positions"
|
|
v-for="(position, i) in positions"
|
|
:key="position.id"
|
|
:key="position.id"
|
|
|
|
+ :class="{ disabled: unKeepAdding && position.id !== showId }"
|
|
:position="position"
|
|
:position="position"
|
|
:title="`位置${i + 1}`"
|
|
:title="`位置${i + 1}`"
|
|
@applyGlobal="(keys) => applyGlobal(position, keys)"
|
|
@applyGlobal="(keys) => applyGlobal(position, keys)"
|
|
@delete="deletePosition(position)"
|
|
@delete="deletePosition(position)"
|
|
/>
|
|
/>
|
|
</Collapse>
|
|
</Collapse>
|
|
|
|
+ <Teleport to="#layout-app">
|
|
|
|
+ <span
|
|
|
|
+ @click="unKeepAdding ? unKeepAdding() : keepAdding()"
|
|
|
|
+ class="pin-position strengthen fun-ctrl"
|
|
|
|
+ >
|
|
|
|
+ <ui-icon
|
|
|
|
+ :style="{ color: unKeepAdding ? 'var(--color-main-normal)' : 'currentColor' }"
|
|
|
|
+ type="pin1"
|
|
|
|
+ size="22px"
|
|
|
|
+ />
|
|
|
|
+ </span>
|
|
|
|
+ </Teleport>
|
|
</RightFillPano>
|
|
</RightFillPano>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -21,7 +34,7 @@ import { Dialog, Message } from "bill/index";
|
|
import { RightFillPano } from "@/layout";
|
|
import { RightFillPano } from "@/layout";
|
|
import { asyncTimeout } from "@/utils";
|
|
import { asyncTimeout } from "@/utils";
|
|
import { useViewStack } from "@/hook";
|
|
import { useViewStack } from "@/hook";
|
|
-import { computed, nextTick, onUnmounted, ref, watch, watchEffect } from "vue";
|
|
|
|
|
|
+import { computed, nextTick, onUnmounted, ref, shallowRef, watch } from "vue";
|
|
import { sdk } from "@/sdk";
|
|
import { sdk } from "@/sdk";
|
|
import { showTaggingPositionsStack } from "@/env";
|
|
import { showTaggingPositionsStack } from "@/env";
|
|
import {
|
|
import {
|
|
@@ -34,10 +47,10 @@ import {
|
|
getTagging,
|
|
getTagging,
|
|
enterEdit,
|
|
enterEdit,
|
|
} from "@/store";
|
|
} from "@/store";
|
|
-import { Collapse, CollapsePanel } from "ant-design-vue";
|
|
|
|
|
|
+import { Collapse } from "ant-design-vue";
|
|
|
|
|
|
import type { TaggingPosition } from "@/store";
|
|
import type { TaggingPosition } from "@/store";
|
|
-import { distance } from "@/utils/math";
|
|
|
|
|
|
+import { clickListener } from "@/utils/event";
|
|
|
|
|
|
const showId = ref<TaggingPosition["id"]>();
|
|
const showId = ref<TaggingPosition["id"]>();
|
|
const tagging = computed(() => getTagging(router.currentRoute.value.params.id as string));
|
|
const tagging = computed(() => getTagging(router.currentRoute.value.params.id as string));
|
|
@@ -63,7 +76,6 @@ const flyTaggingPosition = (position: TaggingPosition) => {
|
|
dur: 300,
|
|
dur: 300,
|
|
distance: 3,
|
|
distance: 3,
|
|
});
|
|
});
|
|
- // setTimeout(pop, 2000);
|
|
|
|
};
|
|
};
|
|
onUnmounted(() => pop && pop());
|
|
onUnmounted(() => pop && pop());
|
|
|
|
|
|
@@ -91,19 +103,16 @@ const applyGlobal = async (position: TaggingPosition, keys: string | string[]) =
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-// const cameraPos = ref<SceneLocalPos>();
|
|
|
|
-// sdk.sceneBus.on("cameraChange", (pos) => (cameraPos.value = pos));
|
|
|
|
-
|
|
|
|
-let unKeepAdding: () => void;
|
|
|
|
|
|
+let unKeepAdding = shallowRef<() => void>();
|
|
const keepAdding = () => {
|
|
const keepAdding = () => {
|
|
|
|
+ unKeepAdding.value && unKeepAdding.value();
|
|
const hide = Message.show({ msg: "请在模型上单击选择标签位置", type: "warning" });
|
|
const hide = Message.show({ msg: "请在模型上单击选择标签位置", type: "warning" });
|
|
- const clickHandler = async (ev: MouseEvent) => {
|
|
|
|
|
|
+ showId.value = void 0;
|
|
|
|
+
|
|
|
|
+ const removeListener = clickListener(sdk.layout, async (pos) => {
|
|
await nextTick();
|
|
await nextTick();
|
|
await asyncTimeout();
|
|
await asyncTimeout();
|
|
- const position = sdk.getPositionByScreen({
|
|
|
|
- x: ev.clientX,
|
|
|
|
- y: ev.clientY,
|
|
|
|
- });
|
|
|
|
|
|
+ const position = sdk.getPositionByScreen(pos);
|
|
|
|
|
|
if (!position) {
|
|
if (!position) {
|
|
Message.error("当前位置无法添加");
|
|
Message.error("当前位置无法添加");
|
|
@@ -113,22 +122,22 @@ const keepAdding = () => {
|
|
taggingId: tagging.value!.id,
|
|
taggingId: tagging.value!.id,
|
|
});
|
|
});
|
|
taggingPositions.value.push(storePosition);
|
|
taggingPositions.value.push(storePosition);
|
|
-
|
|
|
|
showId.value = storePosition.id;
|
|
showId.value = storePosition.id;
|
|
- // if (cameraPos.value && distance(cameraPos.value, position.worldPos) > 8) {
|
|
|
|
- // flyTaggingPosition(storePosition);
|
|
|
|
- // }
|
|
|
|
}
|
|
}
|
|
- };
|
|
|
|
- sdk.layout.addEventListener("click", clickHandler, false);
|
|
|
|
|
|
+ });
|
|
|
|
|
|
- unKeepAdding = () => {
|
|
|
|
|
|
+ unKeepAdding.value = () => {
|
|
hide();
|
|
hide();
|
|
- sdk.layout.removeEventListener("click", clickHandler, false);
|
|
|
|
|
|
+ removeListener();
|
|
|
|
+ unKeepAdding.value = void 0;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
+onUnmounted(() => unKeepAdding.value && unKeepAdding.value());
|
|
|
|
|
|
useViewStack(autoSaveTaggings);
|
|
useViewStack(autoSaveTaggings);
|
|
|
|
+useViewStack(() => {
|
|
|
|
+ enterEdit(() => router.back());
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -139,6 +148,20 @@ h3 {
|
|
color: #999999;
|
|
color: #999999;
|
|
margin-bottom: 4px;
|
|
margin-bottom: 4px;
|
|
}
|
|
}
|
|
|
|
+.pin-position {
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 50%;
|
|
|
|
+ transform: translate(-50%);
|
|
|
|
+ width: 64px;
|
|
|
|
+ height: 64px;
|
|
|
|
+ background: rgba(27, 27, 28, 0.8);
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ bottom: 20px;
|
|
|
|
+ z-index: 9;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
.position-group .group-title {
|
|
.position-group .group-title {
|