Skip to content

Commit e645018

Browse files
committed
标线编辑器
1 parent a56cca2 commit e645018

File tree

7 files changed

+82
-24
lines changed

7 files changed

+82
-24
lines changed

src/editor/annotaions.vue

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/editor/annotation.vue

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<div class="plot-data">
3+
<s-segmented-button v-model.lazy="props.annotation.axis">
4+
<s-segmented-button-item value="y">{{
5+
t("annotation.horizontal")
6+
}}</s-segmented-button-item>
7+
<s-segmented-button-item value="x">
8+
{{ t("annotation.vertical") }}
9+
</s-segmented-button-item>
10+
</s-segmented-button>
11+
<s-text-field
12+
class="styled"
13+
type="number"
14+
v-model="props.annotation.value"
15+
></s-text-field>
16+
<s-text-field
17+
:label="t('annotation.text')"
18+
v-model.lazy="props.annotation.text"
19+
></s-text-field>
20+
</div>
21+
</template>
22+
23+
<script setup lang="ts">
24+
import { InternalAnnotation } from "@/consts";
25+
import { useI18n } from "vue-i18n";
26+
const { t } = useI18n();
27+
28+
const props = defineProps<{
29+
index: number;
30+
annotation: InternalAnnotation;
31+
}>();
32+
33+
import emitter from "@/mitt";
34+
import { watch } from "vue";
35+
watch([() => props.annotation.axis, () => props.annotation.text], () =>
36+
emitter.emit("require-post-update", "anntaions axis change")
37+
);
38+
</script>

src/editor/annotationList.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<s-scroll-view>
3+
<AnimatedList>
4+
<AnimatedListItem v-for="(item, index) in profile.annotations">
5+
<Annotation :index="index" :annotation="item" class="datumFolder" />
6+
</AnimatedListItem>
7+
</AnimatedList>
8+
<div class="plot-data add-data" @click="profile.addAnnotation">
9+
<s-icon name="add" />
10+
{{ t("buttons.add") }}
11+
<s-ripple attached></s-ripple>
12+
</div>
13+
</s-scroll-view>
14+
</template>
15+
16+
<script setup lang="ts">
17+
import { useI18n } from "vue-i18n";
18+
const { t } = useI18n();
19+
20+
import AnimatedList from "@/ui/animatedList/animatedList.vue";
21+
import AnimatedListItem from "@/ui/animatedList/animatedListItem.vue";
22+
import Annotation from "./annotation.vue";
23+
24+
import { useProfile } from "@/states";
25+
const profile = useProfile();
26+
</script>

src/editor/datumList.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</AnimatedListItem>
1616
</AnimatedList>
1717
</VueDraggable>
18-
<div class="plot-data add-data" @click="profile.data.push(getNewDatum())">
18+
<div class="plot-data add-data" @click="profile.addData">
1919
<s-icon name="add" />
2020
{{ t("buttons.add") }}
2121
<s-ripple attached></s-ripple>
@@ -33,7 +33,6 @@ import AnimatedList from "@/ui/animatedList/animatedList.vue";
3333
import AnimatedListItem from "@/ui/animatedList/animatedListItem.vue";
3434
import Datum from "./datum.vue";
3535
36-
import { getNewDatum } from "@/consts";
3736
import { useProfile } from "@/states";
3837
const profile = useProfile();
3938
</script>

src/editor/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const { t } = useI18n();
2121
2222
import ImportBtn from "./import.vue";
2323
import DatumList from "./datumList.vue";
24-
import AnnotaionList from "./annotaions.vue";
24+
import AnnotaionList from "./annotationList.vue";
2525
import GraphOptions from "./options.vue";
2626
2727
import OutputDrawer from "./output.vue";

src/editor/options.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<s-text-field :label="t('inputs.caption')"></s-text-field>
1313
</div>
1414

15-
<s-divider>{{ t("title.horizontal") }}</s-divider>
15+
<s-divider>{{ t("title.horizontalAxis") }}</s-divider>
1616
<div class="option">
1717
<span class="label">{{ t("inputs.grow") }}</span>
1818
<s-picker :label="t('inputs.grow')" :key="locale">
@@ -31,7 +31,7 @@
3131
<s-text-field :label="t('inputs.caption')"></s-text-field>
3232
</div>
3333

34-
<s-divider>{{ t("title.vertical") }}</s-divider>
34+
<s-divider>{{ t("title.verticalAxis") }}</s-divider>
3535
<div class="option">
3636
<span class="label">{{ t("inputs.grow") }}</span>
3737
<s-picker :label="t('inputs.grow')" :key="locale">

src/i18n.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,15 @@ export default {
8383
graphOptions: "绘制选项",
8484
inDev: "开发中",
8585
global: "全局",
86-
horizontal: "横轴",
87-
vertical: "纵轴",
86+
horizontalAxis: "横轴",
87+
verticalAxis: "纵轴",
8888
annotaions: "标线列表",
8989
},
90+
annotation: {
91+
horizontal: "水平",
92+
vertical: "竖直",
93+
text: "文本",
94+
},
9095
},
9196
"en-US": {
9297
buttons: {
@@ -153,10 +158,15 @@ export default {
153158
graphOptions: "Graph options",
154159
inDev: "In development",
155160
global: "Global",
156-
horizontal: "Horizontal Axis",
157-
vertical: "Vertical Axis",
161+
horizontalAxis: "Horizontal Axis",
162+
verticalAxis: "Vertical Axis",
158163
annotaions: "Annotation list",
159164
},
165+
annotation: {
166+
horizontal: "Horizontal",
167+
vertical: "Vertical",
168+
text: "Text",
169+
},
160170
},
161171
},
162172
} as I18nOpt;

0 commit comments

Comments
 (0)