Skip to content

Commit add572e

Browse files
committed
切线割线面板
1 parent 7ed31a0 commit add572e

File tree

5 files changed

+96
-4
lines changed

5 files changed

+96
-4
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"base": "mock",
2121
"color": "cyan-800",
2222
"lightColor": "light-green-700",
23-
"folderNames": ["inputs"]
23+
"folderNames": ["inputs", "subblocks"]
2424
}
2525
],
2626
"material-icon-theme.files.associations": {

src/editor/inputs/inputs.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
}
2323

24-
s-fold {
24+
& > s-fold {
2525
margin: -8px -15px 0 -15px;
2626
}
2727
s-divider {

src/editor/inputs/linear.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
<s-divider>{{ t("data.more.dividerTitle") }}</s-divider>
99
<div class="input-inner-optional">
1010
<div class="fields">
11+
<span class="label"> 切线与割线 </span>
12+
<s-popup class="derivate-popup input" align="right">
13+
<s-button type="outlined" slot="trigger"> 设置面板 </s-button>
14+
<DerivatePane :self="self"/>
15+
</s-popup>
1116
<span class="label"> {{ t("data.more.range") }} </span>
1217
<Domain :self="self" />
1318
<span class="label">
@@ -41,7 +46,7 @@
4146

4247
<script setup lang="ts">
4348
import { PrivateDataTypes } from "@/types/data";
44-
import { toRef } from "vue";
49+
import { toRef } from "vue";
4550
import { useI18n } from "vue-i18n";
4651
import { I18nSchema } from "@/i18n";
4752
const { t } = useI18n<{ message: I18nSchema }>();
@@ -57,5 +62,8 @@ import FilledTextfield from "./subblocks/function.vue";
5762
import HelpIcon from "./subblocks/helpIcon.vue";
5863
import ColorPicker from "./subblocks/colorPicker.vue";
5964
import Domain from "./subblocks/domain.vue";
65+
import DerivatePane from "./subblocks/derivatePane.vue";
6066
import "./inputs.scss";
67+
6168
</script>
69+

src/editor/inputs/subblocks/colorPicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<s-icon name="close"></s-icon>
1515
</s-icon-button>
1616
</Transition>
17-
<s-popup slot="end" ref="popup" @show="pickerKey = Symbol()">
17+
<s-popup slot="end" @show="pickerKey = Symbol()" align="right">
1818
<s-icon-button
1919
slot="trigger"
2020
class="colorpicker-button"
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<template>
2+
<div class="derivate-pane">
3+
<s-tab mode="fixed" v-model.lazy="tab">
4+
<s-tab-item value="derivate">
5+
<div slot="text">切线设置</div>
6+
</s-tab-item>
7+
<s-tab-item value="secant">
8+
<div slot="text">割线设置</div>
9+
</s-tab-item>
10+
</s-tab>
11+
12+
<!-- derivate -->
13+
<div class="content" v-if="tab === 'derivate'">
14+
<div class="field">
15+
<div class="label">启用切线显示</div>
16+
<s-switch type="checkbox" v-model.lazy="derivateEnabled"></s-switch>
17+
</div>
18+
<div class="field main-fn">
19+
<span class="label styled">y'=</span>
20+
<FunctionField class="styled fn" label="f'(x)" v-model="derivateFn" />
21+
</div>
22+
<div class="field">
23+
<div class="label">切点位置</div>
24+
<s-segmented-button value="b">
25+
<s-segmented-button-item value="a"> 指定切点 </s-segmented-button-item>
26+
<s-segmented-button-item value="b"> 跟随鼠标 </s-segmented-button-item>
27+
</s-segmented-button>
28+
</div>
29+
<div class="field">
30+
<div class="label">切点横坐标</div>
31+
<s-text-field type="number" label="x" class="styled"></s-text-field>
32+
</div>
33+
</div>
34+
35+
<!-- secant -->
36+
<div class="content" v-else>
37+
<div class="field">
38+
<div class="label">启用割线显示</div>
39+
<s-switch type="checkbox" v-model.lazy="secantEnabled"></s-switch>
40+
</div>
41+
42+
</div>
43+
</div>
44+
</template>
45+
46+
<script lang="ts" setup>
47+
import { PrivateDataTypes } from "@/types/data";
48+
import { ref, toRef } from "vue";
49+
import FunctionField from "./function.vue";
50+
51+
const props = defineProps<{
52+
self: PrivateDataTypes.Linear;
53+
}>();
54+
55+
const tab = ref("derivate");
56+
const self = toRef(props, "self");
57+
58+
const derivateEnabled = ref(false);
59+
const derivateFn = ref("");
60+
const secantEnabled = ref(false);
61+
</script>
62+
63+
<style lang="scss">
64+
.derivate-pane {
65+
width: 25em;
66+
.content {
67+
padding: 15px;
68+
display: flex;
69+
flex-direction: column;
70+
gap: 0.5em;
71+
}
72+
.field {
73+
display: flex;
74+
justify-content: space-between;
75+
align-items: center;
76+
}
77+
.field.main-fn {
78+
font-size: 1.5em;
79+
.label {
80+
width: 2.2em;
81+
}
82+
}
83+
}
84+
</style>

0 commit comments

Comments
 (0)