|
@@ -17,28 +17,54 @@
|
|
|
<span class="font-size">{{ size }}</span>
|
|
|
</template>
|
|
|
<ui-icon type="del" class="del-icon" v-if="data.key === 'del'" />
|
|
|
-
|
|
|
+ <ui-icon type="del" class="del-icon" v-if="data.key === 'text'" />
|
|
|
</template>
|
|
|
-
|
|
|
</GeoTeleport>
|
|
|
+
|
|
|
+ <div class="text-model" v-if="updateText">
|
|
|
+ <div class="text-input">
|
|
|
+ <ui-input
|
|
|
+ ref="inputTextRef"
|
|
|
+ v-model="text"
|
|
|
+ width="100%"
|
|
|
+ height="64px"
|
|
|
+ @blur="updateText = false"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
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 {uiType, UIType, FocusVector, drawRef} from '@/hook/useGraphic'
|
|
|
+import {FocusVector, drawRef} from '@/hook/useGraphic'
|
|
|
import {computed, ref, watch, watchEffect} from "vue";
|
|
|
import {dataService} from "@/graphic/Service/DataService";
|
|
|
-import {debounce} from '@/utils/index'
|
|
|
+import {debounce} from '@/utils'
|
|
|
import GeoActions from "@/graphic/enum/GeoActions";
|
|
|
|
|
|
const props = defineProps<{geo: FocusVector}>()
|
|
|
+const inputTextRef = ref()
|
|
|
+const updateText = ref(false)
|
|
|
const vector = computed(() => dataService.getText(props.geo.vectorId))
|
|
|
const text = ref("")
|
|
|
const color = ref("#000000")
|
|
|
const size = ref(18)
|
|
|
|
|
|
+const syncVector = ([text, size, color]) => {
|
|
|
+ vector.value.setValue(text)
|
|
|
+ vector.value.setColor(color)
|
|
|
+ vector.value.setFontSize(size)
|
|
|
+ drawRef.value.renderer.autoRedraw()
|
|
|
+}
|
|
|
+
|
|
|
+watchEffect(() => {
|
|
|
+ if (inputTextRef.value) {
|
|
|
+ inputTextRef.value.vmRef.input.focus()
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
watchEffect(() => {
|
|
|
color.value = vector.value.color
|
|
|
size.value = vector.value.fontSize
|
|
@@ -46,12 +72,7 @@ watchEffect(() => {
|
|
|
})
|
|
|
watch(
|
|
|
() => [text.value, size.value, color.value],
|
|
|
- debounce(([text, size, color]) => {
|
|
|
- vector.value.setValue(text)
|
|
|
- vector.value.setColor(color)
|
|
|
- vector.value.setFontSize(size)
|
|
|
- drawRef.value.renderer.autoRedraw()
|
|
|
- }, 500)
|
|
|
+ debounce(syncVector, 500)
|
|
|
)
|
|
|
|
|
|
const sizeOption = [];
|
|
@@ -68,6 +89,11 @@ const menus = [
|
|
|
text: "文字大小"
|
|
|
},
|
|
|
{
|
|
|
+ key: 'text',
|
|
|
+ text: "修改文字",
|
|
|
+ onClick: () => updateText.value = true
|
|
|
+ },
|
|
|
+ {
|
|
|
key: 'del',
|
|
|
text: "删除",
|
|
|
onClick: () => {
|
|
@@ -105,10 +131,32 @@ const menus = [
|
|
|
z-index: 1;
|
|
|
opacity: 0;
|
|
|
}
|
|
|
+
|
|
|
+.text-model {
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background-color: rgba(0,0,0,.8);
|
|
|
+ z-index: 4
|
|
|
+}
|
|
|
+
|
|
|
+.text-input {
|
|
|
+ width: 785px;
|
|
|
+ height: 64px;
|
|
|
+ display: block;
|
|
|
+ margin: 176px auto 0;
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|
|
|
.select-floating.select-float.dire-top {
|
|
|
margin-top: -10px;
|
|
|
}
|
|
|
+
|
|
|
+.text-input .ui-input .text input {
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 16px 21px;
|
|
|
+}
|
|
|
</style>
|