|
@@ -1,19 +1,27 @@
|
|
|
<template>
|
|
|
<GeoTeleport :menus="menus" class="geo-teleport-use" :active="active" />
|
|
|
<GeoTeleport :menus="childMenus" v-if="childMenus" class="type-geo" />
|
|
|
- <VRange v-if="showChange" :max="1000" :min="0" :step="1" unit="mm" v-model:value="(lineWidthMenu[2].desc as number)" />
|
|
|
+ <VRange
|
|
|
+ v-if="showChange"
|
|
|
+ :max="1000"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ unit="mm"
|
|
|
+ v-model:value="(lineWidthMenu[2].desc as number)"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import GeoTeleport from "@/views/graphic/geos/geo-teleport.vue";
|
|
|
import { drawRef, FocusVector } from "@/hook/useGraphic";
|
|
|
-import { computed, reactive, ref, toRaw, UnwrapRef, watchEffect } from "vue";
|
|
|
+import { computed, reactive, ref, toRaw, UnwrapRef, watch, watchEffect } from "vue";
|
|
|
import { dataService } from "@/graphic/Service/DataService";
|
|
|
import { UITypeExtend } from "@/views/graphic/menus";
|
|
|
import VectorStyle from "@/graphic/enum/VectorStyle";
|
|
|
import VectorWeight from "@/graphic/enum/VectorWeight";
|
|
|
import VRange from "@/components/vrange/index.vue";
|
|
|
import VectorType from "@/graphic/enum/VectorType";
|
|
|
+import { debounce, throttle } from "@/utils";
|
|
|
const props = defineProps<{ geo: FocusVector }>();
|
|
|
const vector = computed(() => dataService.getGeo(props.geo.type, props.geo.vectorId));
|
|
|
const style = ref(vector.value.style || VectorStyle.SingleSolidLine);
|
|
@@ -122,22 +130,37 @@ watchEffect(() => {
|
|
|
lineWidthMenu[2].desc = vector.value.roadSide.width * 1000;
|
|
|
// }
|
|
|
} else {
|
|
|
- (menus.value[1] = vector.value?.weight === VectorWeight.Bold ? lineWidthMenu[0] : lineWidthMenu[1]), (showChange.value = false);
|
|
|
+ (menus.value[1] =
|
|
|
+ vector.value?.weight === VectorWeight.Bold ? lineWidthMenu[0] : lineWidthMenu[1]),
|
|
|
+ (showChange.value = false);
|
|
|
}
|
|
|
});
|
|
|
-watchEffect(() => {
|
|
|
- if (style.value === VectorStyle.RoadSide) {
|
|
|
- if (vector.value.geoType == VectorType.CurveRoadEdge) {
|
|
|
- vector.value.setCurveRoadSideWidth((lineWidthMenu[2].desc as number) / 1000);
|
|
|
- } else {
|
|
|
- vector.value.setRoadSideWidth((lineWidthMenu[2].desc as number) / 1000);
|
|
|
+const updateWidth = debounce(() => {
|
|
|
+ vector.value.setRoadSideWidth((lineWidthMenu[2].desc as number) / 1000);
|
|
|
+ drawRef.value.renderer.autoRedraw();
|
|
|
+ drawRef.value.history.save();
|
|
|
+}, 500);
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => [style.value, lineWidthMenu[2].desc],
|
|
|
+ () => {
|
|
|
+ if (style.value === VectorStyle.RoadSide) {
|
|
|
+ if (vector.value.geoType == VectorType.CurveRoadEdge) {
|
|
|
+ vector.value.setCurveRoadSideWidth((lineWidthMenu[2].desc as number) / 1000);
|
|
|
+ } else {
|
|
|
+ console.log(lineWidthMenu[2].desc);
|
|
|
+ updateWidth();
|
|
|
+ }
|
|
|
}
|
|
|
- drawRef.value.renderer.autoRedraw();
|
|
|
}
|
|
|
-});
|
|
|
+);
|
|
|
|
|
|
const active = computed(() => {
|
|
|
- return toRaw(childMenus.value) === lineTypeMenu ? menus.value[0] : toRaw(childMenus.value) === lineWidthMenu ? menus.value[1] : null;
|
|
|
+ return toRaw(childMenus.value) === lineTypeMenu
|
|
|
+ ? menus.value[0]
|
|
|
+ : toRaw(childMenus.value) === lineWidthMenu
|
|
|
+ ? menus.value[1]
|
|
|
+ : null;
|
|
|
});
|
|
|
</script>
|
|
|
|