Skip to content

Commit 5e85bf2

Browse files
committed
字体优化
数值框符号改成窄的 函数框输入时强制刷新,显示连字
1 parent 0a7f709 commit 5e85bf2

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed
684 Bytes
Binary file not shown.

src/editor/inputs/implicit.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="input-inner">
33
<div class="field main-fn">
4-
<FunctionField class="styled fn" label="f(x, y)" v-model="self.fn" />
4+
<FunctionField class="fn" label="f(x, y)" v-model="self.fn" />
55
<span class="label styled"> =0 </span>
66
</div>
77
<AnimatedFold :folded="props.folded">
@@ -20,7 +20,6 @@
2020
<s-checkbox
2121
type="checkbox"
2222
v-model.lazy="self.closed"
23-
:disabled="self.graphType === 'scatter'"
2423
>
2524
{{ t("data.more.closed") }}
2625
</s-checkbox>

src/editor/inputs/linear.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="input-inner">
33
<div class="field main-fn">
44
<span class="label styled">y=</span>
5-
<FunctionField class="styled fn" label="f(x)" v-model="self.fn" />
5+
<FunctionField class="fn" label="f(x)" v-model="self.fn" />
66
</div>
77
<AnimatedFold :folded="props.folded">
88
<s-divider>{{ t("data.more.dividerTitle") }}</s-divider>

src/editor/inputs/parametric.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<div class="input-inner">
33
<div class="field main-fn">
44
<span class="label styled">x=</span>
5-
<FunctionField class="styled fn" label="f(t)" v-model="self.x" />
5+
<FunctionField class="fn" label="f(t)" v-model="self.x" />
66
</div>
77
<div class="field main-fn">
88
<span class="label styled">y=</span>
9-
<FunctionField class="styled fn" label="g(t)" v-model="self.y" />
9+
<FunctionField class="fn" label="g(t)" v-model="self.y" />
1010
</div>
1111
<AnimatedFold :folded="props.folded">
1212
<s-divider>{{ t("data.more.dividerTitle") }}</s-divider>

src/editor/inputs/polar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="field main-fn">
44
<span class="label styled">ρ=</span>
55
<FunctionField
6-
class="styled fn"
6+
class="fn"
77
ref="inputBox"
88
label="f(θ)"
99
v-model="self.r"

src/editor/inputs/subblocks/function.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<label :class="{ lifted: !isEmpty }">{{ props.label }}</label>
44
<input
55
@focus="isFocus = true"
6-
@blur="
7-
isFocus = false;
8-
refreshInput();
9-
"
6+
@blur="isFocus = false"
107
type="text"
118
v-model="value"
129
ref="inputRef"
@@ -15,7 +12,7 @@
1512
</template>
1613

1714
<script setup lang="ts">
18-
import { computed, ref } from "vue";
15+
import { computed, ref, watch } from "vue";
1916
2017
const value = defineModel<string>({ required: true });
2118
const props = defineProps<{
@@ -29,9 +26,12 @@ function refreshInput() {
2926
// On Chromium browsers, ligatures over 3 characters are not displayed until force refresh
3027
// Manually setting the value won't trigger Vue's reactivity system, no performance issue
3128
if (!inputRef.value) return;
29+
const { selectionStart, selectionEnd } = inputRef.value;
3230
inputRef.value.value = value.value + "\u200B";
3331
inputRef.value.value = value.value;
32+
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3433
}
34+
watch(value, refreshInput);
3535
</script>
3636

3737
<style lang="scss">
@@ -45,6 +45,7 @@ function refreshInput() {
4545
border-bottom-color 0.2s;
4646
padding: 0;
4747
display: flex;
48+
font-family: var(--font-math);
4849
&.focus {
4950
background-color: var(--s-color-surface-container-highest);
5051
border-bottom-color: var(--s-color-primary);

src/public.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ input[type="number"] {
4242
src: url("/fonts/KaTeX_AllInOne.woff2");
4343
}
4444

45+
@font-face {
46+
font-family: "KaTeX_Neg";
47+
src: url("/fonts/KaTeX_AllInOne_Neg.woff2");
48+
}
49+
4550
.styled,
4651
.styled::part(input),
4752
.styled-inner::part(input) {
48-
font-family: var(--font-math);
53+
font-family: "KaTeX_Neg", var(--font-math);
4954
font-variant-ligatures: common-ligatures discretionary-ligatures contextual
5055
historical-ligatures;
5156
}

0 commit comments

Comments
 (0)