From f340c86a416c2369590b069c3d230d5318561805 Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Wed, 11 Jun 2025 21:25:15 +0800 Subject: [PATCH] feat: add rect select but have some problems --- src/stores/equipments.ts | 2 +- src/{ => utils}/Common.ts | 2 +- src/utils/VueKonvaType.ts | 30 ++++ src/views/AdminView.vue | 2 +- src/views/ProjectView.vue | 324 +++++++++++++++++++++++++++++++------- src/views/TestView.vue | 2 +- 6 files changed, 298 insertions(+), 64 deletions(-) rename src/{ => utils}/Common.ts (91%) create mode 100644 src/utils/VueKonvaType.ts diff --git a/src/stores/equipments.ts b/src/stores/equipments.ts index 5d00ee6..9fed7a3 100644 --- a/src/stores/equipments.ts +++ b/src/stores/equipments.ts @@ -1,7 +1,7 @@ import { ref, reactive, watchPostEffect } from 'vue' import { defineStore } from 'pinia' import { isString, toNumber } from 'lodash'; -import { Common } from '@/Common'; +import { Common } from '@/utils/Common'; import z from "zod" import { isNumber } from 'mathjs'; import { JtagClient, MatrixKeyClient, PowerClient } from "@/APIClient"; diff --git a/src/Common.ts b/src/utils/Common.ts similarity index 91% rename from src/Common.ts rename to src/utils/Common.ts index 406186f..259fea8 100644 --- a/src/Common.ts +++ b/src/utils/Common.ts @@ -1,4 +1,4 @@ -import { type FileParameter } from "./APIClient"; +import { type FileParameter } from "@/APIClient"; import { isNull, isUndefined } from "lodash"; export namespace Common { diff --git a/src/utils/VueKonvaType.ts b/src/utils/VueKonvaType.ts new file mode 100644 index 0000000..e9f7c54 --- /dev/null +++ b/src/utils/VueKonvaType.ts @@ -0,0 +1,30 @@ +import Konva from "konva"; +import type { VueElement } from "vue"; + +interface VNode extends VueElement { + getNode(): Konva.Node +} + +interface VLayer extends VueElement { + getNode(): Konva.Layer +} + +interface VGroup extends VueElement { + getNode(): Konva.Group +} + +interface VStage extends VueElement { + getStage(): Konva.Stage +} + +interface VTransformer extends VueElement { + getNode(): Konva.Transformer +} + +export type { + VNode, + VLayer, + VGroup, + VStage, + VTransformer, +} diff --git a/src/views/AdminView.vue b/src/views/AdminView.vue index 9b3b625..5e76914 100644 --- a/src/views/AdminView.vue +++ b/src/views/AdminView.vue @@ -115,7 +115,7 @@ import { isNull, isUndefined } from "lodash"; import { ref } from "vue"; import { RemoteUpdateClient } from "@/APIClient"; import { useDialogStore } from "@/stores/dialog"; -import { Common } from "@/Common"; +import { Common } from "@/utils/Common"; const dialog = useDialogStore(); diff --git a/src/views/ProjectView.vue b/src/views/ProjectView.vue index ce94090..16f9106 100644 --- a/src/views/ProjectView.vue +++ b/src/views/ProjectView.vue @@ -1,25 +1,33 @@