|
@@ -1,144 +1,163 @@
|
|
<template>
|
|
<template>
|
|
- <GeoTeleport :active="active" :menus="menus" class="geo-teleport-use"/>
|
|
|
|
- <GeoTeleport v-if="childMenus" :menus="childMenus" class="type-geo"/>
|
|
|
|
|
|
+ <GeoTeleport :active="active" :menus="menus" class="geo-teleport-use" />
|
|
|
|
+ <GeoTeleport v-if="childMenus" :menus="childMenus" class="type-geo" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import GeoTeleport from "@/views/graphic/geos/geo-teleport.vue";
|
|
import GeoTeleport from "@/views/graphic/geos/geo-teleport.vue";
|
|
-import {drawRef, FocusVector, VectorType} from '@/hook/useGraphic'
|
|
|
|
-import {computed, ref, toRaw, UnwrapRef} from "vue";
|
|
|
|
-import {dataService} from "@/graphic/Service/DataService";
|
|
|
|
-import GeoActions from "@/graphic/enum/GeoActions"
|
|
|
|
-import {UITypeExtend} from "@/views/graphic/menus";
|
|
|
|
|
|
+import { drawRef, FocusVector, VectorType } from "@/hook/useGraphic";
|
|
|
|
+import { computed, ref, toRaw, UnwrapRef } from "vue";
|
|
|
|
+import { dataService } from "@/graphic/Service/DataService";
|
|
|
|
+import GeoActions from "@/graphic/enum/GeoActions";
|
|
|
|
+import { UITypeExtend } from "@/views/graphic/menus";
|
|
import VectorEvents from "@/graphic/enum/VectorEvents";
|
|
import VectorEvents from "@/graphic/enum/VectorEvents";
|
|
import VectorStyle from "@/graphic/enum/VectorStyle";
|
|
import VectorStyle from "@/graphic/enum/VectorStyle";
|
|
import VectorWeight from "@/graphic/enum/VectorWeight";
|
|
import VectorWeight from "@/graphic/enum/VectorWeight";
|
|
import VectorCategory from "@/graphic/enum/VectorCategory";
|
|
import VectorCategory from "@/graphic/enum/VectorCategory";
|
|
|
|
|
|
-
|
|
|
|
-const props = defineProps<{ geo: FocusVector }>()
|
|
|
|
-const vector = computed(() => dataService.getLine(props.geo.vectorId))
|
|
|
|
-
|
|
|
|
-const isCurve = props.geo.type === VectorType.CurveLine
|
|
|
|
|
|
+const props = defineProps<{ geo: FocusVector }>();
|
|
|
|
+const vector = computed(() => dataService.getLine(props.geo.vectorId));
|
|
|
|
+const style = ref(vector.value.style || VectorStyle.SingleSolidLine);
|
|
|
|
+const isCurve = props.geo.type === VectorType.CurveLine;
|
|
const clickHandlerFactory = (key) => {
|
|
const clickHandlerFactory = (key) => {
|
|
- return () => drawRef.value.uiControl.updateVectorForSelectUI(key)
|
|
|
|
-}
|
|
|
|
-console.log(props)
|
|
|
|
|
|
+ return () => drawRef.value.uiControl.updateVectorForSelectUI(key);
|
|
|
|
+};
|
|
|
|
|
|
const lineTypeMenu = [
|
|
const lineTypeMenu = [
|
|
{
|
|
{
|
|
key: VectorStyle.SingleSolidLine,
|
|
key: VectorStyle.SingleSolidLine,
|
|
icon: "line_sf",
|
|
icon: "line_sf",
|
|
text: "单实线",
|
|
text: "单实线",
|
|
- onClick: clickHandlerFactory(VectorStyle.SingleSolidLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.SingleSolidLine)();
|
|
|
|
+ style.value = VectorStyle.SingleSolidLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
key: VectorStyle.SingleDashedLine,
|
|
key: VectorStyle.SingleDashedLine,
|
|
icon: "line_sd",
|
|
icon: "line_sd",
|
|
text: "单虚线",
|
|
text: "单虚线",
|
|
- onClick: clickHandlerFactory(VectorStyle.SingleDashedLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.SingleDashedLine)();
|
|
|
|
+ style.value = VectorStyle.SingleDashedLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
hide: isCurve,
|
|
hide: isCurve,
|
|
key: VectorStyle.DoubleSolidLine,
|
|
key: VectorStyle.DoubleSolidLine,
|
|
icon: "line_df",
|
|
icon: "line_df",
|
|
text: "双实线",
|
|
text: "双实线",
|
|
- onClick: clickHandlerFactory(VectorStyle.DoubleSolidLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.DoubleSolidLine)();
|
|
|
|
+ style.value = VectorStyle.DoubleSolidLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
hide: isCurve,
|
|
hide: isCurve,
|
|
key: VectorStyle.DoubleDashedLine,
|
|
key: VectorStyle.DoubleDashedLine,
|
|
icon: "line_dd",
|
|
icon: "line_dd",
|
|
text: "双虚线",
|
|
text: "双虚线",
|
|
- onClick: clickHandlerFactory(VectorStyle.DoubleDashedLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.DoubleDashedLine)();
|
|
|
|
+ style.value = VectorStyle.DoubleDashedLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
hide: isCurve,
|
|
hide: isCurve,
|
|
key: VectorStyle.BrokenLine,
|
|
key: VectorStyle.BrokenLine,
|
|
icon: "line_broken",
|
|
icon: "line_broken",
|
|
text: "折线",
|
|
text: "折线",
|
|
- onClick: clickHandlerFactory(VectorStyle.BrokenLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.BrokenLine)();
|
|
|
|
+ style.value = VectorStyle.BrokenLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
key: VectorStyle.PointDrawLine,
|
|
key: VectorStyle.PointDrawLine,
|
|
icon: "line_dot",
|
|
icon: "line_dot",
|
|
text: "点画线",
|
|
text: "点画线",
|
|
- onClick: clickHandlerFactory(VectorStyle.PointDrawLine)
|
|
|
|
|
|
+ onClick: () => {
|
|
|
|
+ clickHandlerFactory(VectorStyle.PointDrawLine)();
|
|
|
|
+ style.value = VectorStyle.PointDrawLine;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
// {key: VectorStyle.Greenbelt, icon: "treelawn", text: "绿化带 ", onClick: clickHandlerFactory(VectorStyle.Greenbelt)},
|
|
// {key: VectorStyle.Greenbelt, icon: "treelawn", text: "绿化带 ", onClick: clickHandlerFactory(VectorStyle.Greenbelt)},
|
|
-]
|
|
|
|
|
|
+];
|
|
const lineWidthMenu = [
|
|
const lineWidthMenu = [
|
|
{
|
|
{
|
|
key: VectorWeight.Bold,
|
|
key: VectorWeight.Bold,
|
|
- icon: 'l_thick',
|
|
|
|
|
|
+ icon: "l_thick",
|
|
text: "宽度",
|
|
text: "宽度",
|
|
onClick: () => {
|
|
onClick: () => {
|
|
- clickHandlerFactory(VectorWeight.Thinning)()
|
|
|
|
- menus.value[1] = lineWidthMenu[1]
|
|
|
|
- }
|
|
|
|
|
|
+ clickHandlerFactory(VectorWeight.Thinning)();
|
|
|
|
+ menus.value[1] = lineWidthMenu[1];
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
key: VectorWeight.Thinning,
|
|
key: VectorWeight.Thinning,
|
|
- icon: 'l_thin',
|
|
|
|
|
|
+ icon: "l_thin",
|
|
text: "宽度",
|
|
text: "宽度",
|
|
onClick: () => {
|
|
onClick: () => {
|
|
- clickHandlerFactory(VectorWeight.Bold)()
|
|
|
|
- menus.value[1] = lineWidthMenu[0]
|
|
|
|
- }
|
|
|
|
|
|
+ clickHandlerFactory(VectorWeight.Bold)();
|
|
|
|
+ menus.value[1] = lineWidthMenu[0];
|
|
|
|
+ },
|
|
},
|
|
},
|
|
-]
|
|
|
|
|
|
+];
|
|
|
|
|
|
-const appendMenus = (props.geo.category === VectorCategory.Line.NormalLine || isCurve)
|
|
|
|
- ? [
|
|
|
|
- {
|
|
|
|
- key: VectorEvents.AddCrossPoint,
|
|
|
|
- icon: "control_a",
|
|
|
|
- text: "加控制点",
|
|
|
|
- onClick: clickHandlerFactory(VectorEvents.AddCrossPoint)
|
|
|
|
- },
|
|
|
|
- // {
|
|
|
|
- // key: VectorEvents.MinusCrossPoint,
|
|
|
|
- // icon: "control_d",
|
|
|
|
- // text: "减控制点",
|
|
|
|
- // onClick: clickHandlerFactory(VectorEvents.MinusCrossPoint)
|
|
|
|
- // },
|
|
|
|
- ]
|
|
|
|
- : []
|
|
|
|
-const childMenus = ref<UnwrapRef<typeof menus>>()
|
|
|
|
|
|
+const appendMenus =
|
|
|
|
+ props.geo.category === VectorCategory.Line.NormalLine || isCurve
|
|
|
|
+ ? [
|
|
|
|
+ {
|
|
|
|
+ key: VectorEvents.AddCrossPoint,
|
|
|
|
+ icon: "control_a",
|
|
|
|
+ text: "加控制点",
|
|
|
|
+ onClick: clickHandlerFactory(VectorEvents.AddCrossPoint),
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // key: VectorEvents.MinusCrossPoint,
|
|
|
|
+ // icon: "control_d",
|
|
|
|
+ // text: "减控制点",
|
|
|
|
+ // onClick: clickHandlerFactory(VectorEvents.MinusCrossPoint)
|
|
|
|
+ // },
|
|
|
|
+ ]
|
|
|
|
+ : [];
|
|
|
|
+const childMenus = ref<UnwrapRef<typeof menus>>();
|
|
const menus = ref([
|
|
const menus = ref([
|
|
- {
|
|
|
|
|
|
+ {
|
|
key: UITypeExtend.lineType,
|
|
key: UITypeExtend.lineType,
|
|
- text: "单实线",
|
|
|
|
- icon: "line",
|
|
|
|
|
|
+ text: computed(() => lineTypeMenu.find((item) => item.key === style.value).text),
|
|
|
|
+ icon: computed(() => lineTypeMenu.find((item) => item.key === style.value).icon),
|
|
onClick() {
|
|
onClick() {
|
|
- childMenus.value = toRaw(childMenus.value) === lineTypeMenu ? null : lineTypeMenu
|
|
|
|
- }
|
|
|
|
|
|
+ childMenus.value = toRaw(childMenus.value) === lineTypeMenu ? null : lineTypeMenu;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
vector.value?.weight === VectorWeight.Bold ? lineWidthMenu[0] : lineWidthMenu[1],
|
|
vector.value?.weight === VectorWeight.Bold ? lineWidthMenu[0] : lineWidthMenu[1],
|
|
...appendMenus,
|
|
...appendMenus,
|
|
{
|
|
{
|
|
- key: 'copy',
|
|
|
|
- icon: 'copy',
|
|
|
|
|
|
+ key: "copy",
|
|
|
|
+ icon: "copy",
|
|
text: "复制",
|
|
text: "复制",
|
|
onClick: () => {
|
|
onClick: () => {
|
|
- drawRef.value.uiControl.handleGeo(GeoActions.CopyAction)
|
|
|
|
- }
|
|
|
|
|
|
+ drawRef.value.uiControl.handleGeo(GeoActions.CopyAction);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- key: 'del',
|
|
|
|
- icon: 'del',
|
|
|
|
|
|
+ key: "del",
|
|
|
|
+ icon: "del",
|
|
text: "删除",
|
|
text: "删除",
|
|
onClick: () => {
|
|
onClick: () => {
|
|
- drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-])
|
|
|
|
|
|
+ drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
|
|
const active = computed(() =>
|
|
const active = computed(() =>
|
|
- toRaw(childMenus.value) === lineTypeMenu ? menus.value[0]
|
|
|
|
- : toRaw(childMenus.value) === lineWidthMenu ? menus.value[1] : null
|
|
|
|
-)
|
|
|
|
-
|
|
|
|
|
|
+ toRaw(childMenus.value) === lineTypeMenu
|
|
|
|
+ ? menus.value[0]
|
|
|
|
+ : toRaw(childMenus.value) === lineWidthMenu
|
|
|
|
+ ? menus.value[1]
|
|
|
|
+ : null
|
|
|
|
+);
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|