Skip to content

Commit ce7505b

Browse files
committed
文本面板
1 parent 76ec681 commit ce7505b

File tree

5 files changed

+67
-26
lines changed

5 files changed

+67
-26
lines changed

src/editor/inputs/inputs.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
grid-template-columns: max-content minmax(auto, 18em);
3535
justify-content: space-between;
3636
align-items: center;
37-
gap: var(--input-inner-gap);
37+
row-gap: var(--input-inner-gap);
38+
column-gap: 1.5em;
3839
}
3940

4041
.input-inner-optional {

src/editor/inputs/text.vue

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,50 @@
11
<template>
2-
<span class="input-title styled">r=</span>
3-
<s-text-field
4-
class="styled"
5-
ref="inputBox"
6-
label="f(x,y)"
7-
v-model="self.text"
8-
></s-text-field>
9-
<s-text-field
10-
class="styled"
11-
ref="inputBox"
12-
label="x"
13-
v-model="self.location[0]"
14-
></s-text-field>
15-
<s-text-field
16-
class="styled"
17-
ref="inputBox"
18-
label="y"
19-
v-model="self.location[1]"
20-
></s-text-field>
21-
<s-divider>{{ t("title.moreOptions") }}</s-divider>
2+
<div class="input-inner vector">
3+
<div class="fields">
4+
<span class="input-title">{{ t("data.main.text") }}</span>
5+
<s-text-field
6+
v-model="self.text"
7+
:label="t('data.main.text')"
8+
class="text-input-box"
9+
></s-text-field>
10+
<span class="input-title">{{ t("data.main.location") }}</span>
11+
<div class="tuple">
12+
<span class="tuple-label styled">(</span>
13+
<s-text-field
14+
class="styled tuple-input"
15+
label="x₀"
16+
v-model="locationX"
17+
type="number"
18+
></s-text-field>
19+
<span class="tuple-label styled">,</span>
20+
<s-text-field
21+
class="styled tuple-input"
22+
label="y₀"
23+
v-model="locationY"
24+
type="number"
25+
></s-text-field>
26+
<span class="tuple-label styled">)</span>
27+
</div>
28+
</div>
29+
<AnimatedFold :folded="props.folded">
30+
<s-divider>{{ t("data.more.dividerTitle") }}</s-divider>
31+
<div class="input-inner-optional">
32+
<div class="fields">
33+
<!-- color -->
34+
<span class="label">
35+
{{ t("data.more.color") }}
36+
<HelpIcon> {{ t("data.more.colorHelp") }} </HelpIcon>
37+
</span>
38+
<ColorPicker v-model="self.color" />
39+
</div>
40+
</div>
41+
</AnimatedFold>
42+
</div>
2243
</template>
2344

2445
<script setup lang="ts">
2546
import { PrivateDataTypes } from "@/types/data";
26-
import { toRef } from "vue";
47+
import { ref, toRef } from "vue";
2748
import { useI18n } from "vue-i18n";
2849
import { I18nSchema } from "@/i18n";
2950
const { t } = useI18n<{ message: I18nSchema }>();
@@ -34,4 +55,18 @@ const props = defineProps<{
3455
index: number;
3556
}>();
3657
const self = toRef(props, "self");
58+
59+
import AnimatedFold from "@/ui/animated/animatedFold.vue";
60+
import HelpIcon from "./subblocks/helpIcon.vue";
61+
import ColorPicker from "./subblocks/colorPicker.vue";
62+
63+
const locationX = ref<number | "">(self.value.location[0]);
64+
const locationY = ref<number | "">(self.value.location[1]);
3765
</script>
66+
67+
<style lang="scss">
68+
.text-input-box {
69+
width: 100%;
70+
font-size: 18px;
71+
}
72+
</style>

src/i18n/en-US.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"graphType": "Renderer",
6161
"vector": "Vector Size",
6262
"offset": "Offset",
63-
"text": "Text"
63+
"text": "Text",
64+
"location": "Text Position"
6465
},
6566
"more": {
6667
"dividerTitle": "More Options",
@@ -75,7 +76,7 @@
7576
"skipTipHelp": "Hide point and coordinate info on mouse hover",
7677
"skipTipWarn": "When 'Hide Hover Tips' is enabled, tangent and secant lines will not follow the mouse"
7778
},
78-
"derivateAndSecants": "Tangents and Secants",
79+
"derivateAndSecants": "Tangents & Secants",
7980
"derivateAndSecantsPane": "Open panel",
8081
"derivate": {
8182
"title": "Tangent Settings",

src/i18n/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"graphType": "绘制方式",
6161
"vector": "向量大小",
6262
"offset": "起点坐标",
63-
"text": "文本"
63+
"text": "文本内容",
64+
"location": "文本位置"
6465
},
6566
"more": {
6667
"dividerTitle": "更多选项",

src/types/data.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ export function toPrivateData(input: Object) {
197197
case "text":
198198
// @ts-ignore expected case fallthrough
199199
case undefined:
200-
if ("text" in data && typeof data.text === "string")
200+
if (
201+
data.fnType === "text" ||
202+
("text" in data && typeof data.text === "string")
203+
)
201204
return amendAttr<PrivateDataTypes.Text>(data, {
202205
fnType: "text",
203206
graphType: "text",

0 commit comments

Comments
 (0)