From 9bb97141e14f2296e137167d4894fe8f48fd5c68 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Fri, 13 Sep 2024 19:02:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=AC=E5=85=B1=E7=9A=84?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DrawAppFormUtils.ts | 27 +++ src/components/draw-app/DrawProperties.vue | 8 +- .../draw-app/properties/IscsTextProperty.vue | 50 +++++ src/drawApp/commonApp.ts | 17 +- .../graphics/IscsTextContentInteraction.ts | 59 ++++++ src/graphics/textContent/TextContent.ts | 71 +++++++ .../textContent/TextContentDrawAssistant.ts | 108 ++++++++++ src/layouts/DrawLayout.vue | 3 +- src/protos/iscs_graphic_data.ts | 189 +++++++++++++++++- 9 files changed, 526 insertions(+), 6 deletions(-) create mode 100644 src/components/DrawAppFormUtils.ts create mode 100644 src/components/draw-app/properties/IscsTextProperty.vue create mode 100644 src/drawApp/graphics/IscsTextContentInteraction.ts create mode 100644 src/graphics/textContent/TextContent.ts create mode 100644 src/graphics/textContent/TextContentDrawAssistant.ts diff --git a/src/components/DrawAppFormUtils.ts b/src/components/DrawAppFormUtils.ts new file mode 100644 index 0000000..33f13eb --- /dev/null +++ b/src/components/DrawAppFormUtils.ts @@ -0,0 +1,27 @@ +import { type GraphicDataBase } from 'src/drawApp/graphics/GraphicDataBase'; +import { IDrawApp } from 'jl-graphic'; +import { onMounted, onUnmounted, reactive, toRaw } from 'vue'; + +export function useFormData( + source: T, + app: IDrawApp +) { + const data = reactive(source); + + onMounted(() => { + app.bindFormData(data); + }); + + onUnmounted(() => { + app.unbindFormData(data); + }); + + function onUpdate() { + const graphic = app.queryStore.queryById(data.id); + if (graphic) { + app.updateGraphicAndRecord(graphic, toRaw(data)); + } + } + + return { data, onUpdate }; +} diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue index 349ff48..dbc804f 100644 --- a/src/components/draw-app/DrawProperties.vue +++ b/src/components/draw-app/DrawProperties.vue @@ -22,7 +22,11 @@