|
@@ -7,73 +7,72 @@
|
|
|
import GeoTeleport from "@/views/graphic/geos/geo-teleport.vue";
|
|
|
import UiInput from "@/components/base/components/input/index.vue";
|
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
|
-import {uploadImage} from '@/store/sync'
|
|
|
-import {drawRef, FocusVector, uiType, UIType} from '@/hook/useGraphic'
|
|
|
-import {computed, reactive, ref, UnwrapRef, watch} from "vue";
|
|
|
-import {dataService} from "@/graphic/Service/DataService";
|
|
|
-import {api} from "@/store/sync";
|
|
|
+import { uploadImage } from "@/store/sync";
|
|
|
+import { drawRef, FocusVector, uiType, UIType } from "@/hook/useGraphic";
|
|
|
+import { computed, reactive, ref, UnwrapRef, watch } from "vue";
|
|
|
+import { dataService } from "@/graphic/Service/DataService";
|
|
|
+import { api } from "@/store/sync";
|
|
|
import GeoActions from "@/graphic/enum/GeoActions";
|
|
|
|
|
|
-const props = defineProps<{geo: FocusVector}>()
|
|
|
-const vector = computed(() => dataService.getMagnifier(props.geo.vectorId))
|
|
|
-const typeMenus = ref<UnwrapRef<typeof menus>>()
|
|
|
-console.log(vector.value)
|
|
|
+const props = defineProps<{ geo: FocusVector }>();
|
|
|
+const vector = computed(() => dataService.getMagnifier(props.geo.vectorId));
|
|
|
+const typeMenus = ref<UnwrapRef<typeof menus>>();
|
|
|
+console.log(vector.value);
|
|
|
const menus = reactive([
|
|
|
{
|
|
|
- key: 'file',
|
|
|
+ key: "file",
|
|
|
text: "拍照",
|
|
|
- icon: 'photo',
|
|
|
+ icon: "photo",
|
|
|
onClick() {
|
|
|
typeMenus.value = !typeMenus.value
|
|
|
? [
|
|
|
- {
|
|
|
- key: 'color',
|
|
|
- icon: 'photo',
|
|
|
- text: "拍照",
|
|
|
- onClick: async () => {
|
|
|
- syncVector(await api.photograph())
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'color',
|
|
|
- icon: 'map',
|
|
|
- text: "相册",
|
|
|
- onClick: async () => {
|
|
|
- syncVector(await api.selectPhotoAlbum())
|
|
|
- }
|
|
|
- },
|
|
|
- ]
|
|
|
- : null
|
|
|
- }
|
|
|
+ {
|
|
|
+ key: "color",
|
|
|
+ icon: "photo",
|
|
|
+ text: "拍照",
|
|
|
+ onClick: async () => {
|
|
|
+ const data = await api.photograph();
|
|
|
+ data && syncVector(data);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "color",
|
|
|
+ icon: "map",
|
|
|
+ text: "相册",
|
|
|
+ onClick: async () => {
|
|
|
+ const data = await api.selectPhotoAlbum();
|
|
|
+ data && syncVector(data);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : null;
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- key: 'reset',
|
|
|
+ key: "reset",
|
|
|
icon: "recover",
|
|
|
text: "恢复默认",
|
|
|
disabled: !vector.value.photoUrl,
|
|
|
- onClick: () => syncVector(null)
|
|
|
+ onClick: () => syncVector(null),
|
|
|
},
|
|
|
{
|
|
|
- key: 'del',
|
|
|
+ key: "del",
|
|
|
icon: "del",
|
|
|
text: "删除",
|
|
|
onClick: () => {
|
|
|
- drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction)
|
|
|
- }
|
|
|
- }
|
|
|
-])
|
|
|
+ drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction);
|
|
|
+ },
|
|
|
+ },
|
|
|
+]);
|
|
|
const syncVector = (url: string) => {
|
|
|
- vector.value.setSrc(url)
|
|
|
- vector.value.setImageData()
|
|
|
- .then(() => {
|
|
|
- drawRef.value.renderer.autoRedraw()
|
|
|
- drawRef.value.history.save()
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
- menus[1].disabled = !vector.value.photoUrl
|
|
|
-}
|
|
|
+ vector.value.setSrc(url);
|
|
|
+ vector.value.setImageData().then(() => {
|
|
|
+ drawRef.value.renderer.autoRedraw();
|
|
|
+ drawRef.value.history.save();
|
|
|
+ });
|
|
|
|
|
|
+ menus[1].disabled = !vector.value.photoUrl;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|