|
@@ -1,29 +1,49 @@
|
|
|
<template>
|
|
<template>
|
|
|
<FixPointPanel
|
|
<FixPointPanel
|
|
|
- v-for="point in fixPoints"
|
|
|
|
|
|
|
+ v-for="point in (fixPoints as FixPoint[])"
|
|
|
:key="point.id"
|
|
:key="point.id"
|
|
|
:data="point"
|
|
:data="point"
|
|
|
:active="point === customMap.activeFixPoint"
|
|
:active="point === customMap.activeFixPoint"
|
|
|
- @change-pos="(pos) => (point.pos = pos)"
|
|
|
|
|
- @focus="() => (customMap.activeFixPoint = point)"
|
|
|
|
|
- @blur="() => (customMap.activeFixPoint = customMap.activeFixPoint === point ? null : customMap.activeFixPoint)"
|
|
|
|
|
|
|
+ @change-pos="(pos) => changePos(point, pos)"
|
|
|
|
|
+ @focus="select(point, false)"
|
|
|
|
|
+ @blur="unSelect(point, false)"
|
|
|
|
|
+ @focus-measure="select(point, true)"
|
|
|
|
|
+ @blur-measure="unSelect(point, true)"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<div ref="menu" @touchstart.stop class="action-menus">
|
|
<div ref="menu" @touchstart.stop class="action-menus">
|
|
|
<!-- <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
|
|
<!-- <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
|
|
|
- <ActionMenus v-if="customMap.activeFixPoint" :menus="activeActionMenus" :active-key="edit ? 'edit' : null" dire="row" />
|
|
|
|
|
|
|
+ <ActionMenus
|
|
|
|
|
+ v-if="customMap.activeFixPoint"
|
|
|
|
|
+ :menus="activeActionMenus"
|
|
|
|
|
+ :active-key="edit ? 'edit' : null"
|
|
|
|
|
+ dire="row"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionMenus
|
|
|
|
|
+ v-if="ingActionMenus"
|
|
|
|
|
+ :menus="ingActionMenus"
|
|
|
|
|
+ :active-key="null"
|
|
|
|
|
+ dire="row"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <EditFixPoint v-if="edit" @quit="edit = null" v-model:text="edit.text" ref="dom" :key="edit.id" />
|
|
|
|
|
|
|
+ <EditFixPoint
|
|
|
|
|
+ v-if="edit"
|
|
|
|
|
+ @quit="edit = null"
|
|
|
|
|
+ v-model:text="edit.text"
|
|
|
|
|
+ ref="dom"
|
|
|
|
|
+ :key="edit.id"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { fixPoints, FixPoint } from '@/store/fixPoint';
|
|
|
|
|
-import FixPointPanel from './fixPoint.vue';
|
|
|
|
|
-import { ref, watch, watchEffect } from 'vue';
|
|
|
|
|
-import { customMap } from '@/hook';
|
|
|
|
|
-import ActionMenus from '@/components/group-button/index.vue';
|
|
|
|
|
-import EditFixPoint from '@/components/edit-fix-point/index.vue';
|
|
|
|
|
|
|
+import { fixPoints, FixPoint } from "@/store/fixPoint";
|
|
|
|
|
+import FixPointPanel from "./fixPoint.vue";
|
|
|
|
|
+import { computed, ref, watch, watchEffect } from "vue";
|
|
|
|
|
+import { customMap } from "@/hook";
|
|
|
|
|
+import ActionMenus from "@/components/group-button/index.vue";
|
|
|
|
|
+import EditFixPoint from "@/components/edit-fix-point/index.vue";
|
|
|
|
|
+import { delFix3d, changePos, quitMeasure, drawstatus, DrawStatus } from "../fixManage";
|
|
|
|
|
|
|
|
const edit = ref<FixPoint>();
|
|
const edit = ref<FixPoint>();
|
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
@@ -32,34 +52,88 @@ watchEffect(() => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-const activeActionMenus = [
|
|
|
|
|
- {
|
|
|
|
|
- key: 'edit',
|
|
|
|
|
- icon: 'edit',
|
|
|
|
|
- text: '编辑',
|
|
|
|
|
- color: '#161A1A',
|
|
|
|
|
- iconColor: '#2F8FFF',
|
|
|
|
|
- onClick() {
|
|
|
|
|
- edit.value = edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint;
|
|
|
|
|
|
|
+const selectMeasure = ref(false);
|
|
|
|
|
+const select = (point: FixPoint, onMeasure: boolean = false) => {
|
|
|
|
|
+ selectMeasure.value = onMeasure;
|
|
|
|
|
+ customMap.activeFixPoint = point;
|
|
|
|
|
+};
|
|
|
|
|
+const unSelect = (point: FixPoint, onMeasure: boolean = false) => {
|
|
|
|
|
+ selectMeasure.value = onMeasure;
|
|
|
|
|
+ customMap.activeFixPoint =
|
|
|
|
|
+ customMap.activeFixPoint === point ? null : customMap.activeFixPoint;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- key: 'delete',
|
|
|
|
|
- icon: 'del',
|
|
|
|
|
- text: '删除',
|
|
|
|
|
- color: '#FF4D4F',
|
|
|
|
|
- iconColor: '#fff',
|
|
|
|
|
- onClick() {
|
|
|
|
|
- const index = fixPoints.value.indexOf(customMap.activeFixPoint);
|
|
|
|
|
- if (~index) {
|
|
|
|
|
- fixPoints.value.splice(index, 1);
|
|
|
|
|
- edit.value = null;
|
|
|
|
|
- customMap.activeFixPoint = null;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
-];
|
|
|
|
|
|
|
+const activeActionMenus = computed(() =>
|
|
|
|
|
+ selectMeasure.value
|
|
|
|
|
+ ? [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: "delete",
|
|
|
|
|
+ icon: "del",
|
|
|
|
|
+ text: "删除",
|
|
|
|
|
+ color: "#FF4D4F",
|
|
|
|
|
+ iconColor: "#fff",
|
|
|
|
|
+ onClick() {
|
|
|
|
|
+ quitMeasure(customMap.activeFixPoint);
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ ]
|
|
|
|
|
+ : [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: "edit",
|
|
|
|
|
+ icon: "edit",
|
|
|
|
|
+ text: "编辑",
|
|
|
|
|
+ color: "#161A1A",
|
|
|
|
|
+ iconColor: "#2F8FFF",
|
|
|
|
|
+ onClick() {
|
|
|
|
|
+ edit.value =
|
|
|
|
|
+ edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: "delete",
|
|
|
|
|
+ icon: "del",
|
|
|
|
|
+ text: "删除",
|
|
|
|
|
+ color: "#FF4D4F",
|
|
|
|
|
+ iconColor: "#fff",
|
|
|
|
|
+ onClick() {
|
|
|
|
|
+ const index = fixPoints.value.indexOf(customMap.activeFixPoint);
|
|
|
|
|
+ if (~index) {
|
|
|
|
|
+ fixPoints.value.splice(index, 1);
|
|
|
|
|
+ edit.value = null;
|
|
|
|
|
+ customMap.activeFixPoint = null;
|
|
|
|
|
+ delFix3d(customMap.activeFixPoint);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ ]
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+const ingActionMenus = computed(() => {
|
|
|
|
|
+ if (drawstatus.value === DrawStatus.ing) {
|
|
|
|
|
+ return [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: "edit",
|
|
|
|
|
+ icon: "edit",
|
|
|
|
|
+ text: "完成",
|
|
|
|
|
+ color: "#161A1A",
|
|
|
|
|
+ iconColor: "#2F8FFF",
|
|
|
|
|
+ onClick() {
|
|
|
|
|
+ drawstatus.value = DrawStatus.complete;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: "delete",
|
|
|
|
|
+ icon: "del",
|
|
|
|
|
+ text: "取消",
|
|
|
|
|
+ color: "#FF4D4F",
|
|
|
|
|
+ iconColor: "#fff",
|
|
|
|
|
+ onClick() {
|
|
|
|
|
+ drawstatus.value = DrawStatus.quit;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
const dom = ref<HTMLDivElement>();
|
|
const dom = ref<HTMLDivElement>();
|
|
|
const menu = ref<HTMLDivElement>();
|
|
const menu = ref<HTMLDivElement>();
|
|
@@ -71,10 +145,10 @@ watchEffect((onCleanup) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// document.documentElement.addEventListener("click", handler)
|
|
// document.documentElement.addEventListener("click", handler)
|
|
|
- document.documentElement.addEventListener('touchstart', handler);
|
|
|
|
|
|
|
+ document.documentElement.addEventListener("touchstart", handler);
|
|
|
onCleanup(() => {
|
|
onCleanup(() => {
|
|
|
// document.documentElement.removeEventListener("click", handler)
|
|
// document.documentElement.removeEventListener("click", handler)
|
|
|
- document.documentElement.removeEventListener('touchstart', handler);
|
|
|
|
|
|
|
+ document.documentElement.removeEventListener("touchstart", handler);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|