@shijiu/jsview-vue-samples 2.2.201 → 2.2.373

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/BakeViewDemo/App.vue +6 -1
  2. package/Basic/components/anim/AnimEasingCubicBezier.vue +56 -0
  3. package/Basic/components/anim/AnimGroup2.vue +33 -0
  4. package/Basic/components/panel/Panel2.vue +8 -3
  5. package/CoupletsTest/widget/Banger/Maroon.vue +0 -1
  6. package/CoupletsTest/widget/Fireworks/Fireworks.vue +0 -2
  7. package/CustomShader/App.vue +30 -13
  8. package/CustomShader/pageFlip.glsl +3 -2
  9. package/DemoHomepage/App.vue +14 -5
  10. package/DemoHomepage/components/Item.vue +23 -12
  11. package/DemoHomepage/index.d.ts +5 -2
  12. package/DemoHomepage/router.js +97 -74
  13. package/DispersedFocusControl/App.vue +67 -0
  14. package/DispersedFocusControl/Button.vue +76 -0
  15. package/DispersedFocusControl/data.js +44 -0
  16. package/DragBox/App.vue +148 -0
  17. package/FlexCellDemo/App.vue +47 -223
  18. package/FlexCellDemo/TestFrame1.vue +88 -0
  19. package/FlexCellDemo/TestFrame2.vue +100 -0
  20. package/FlexCellDemo/TestFrame3.vue +97 -0
  21. package/FlexCellDemo/TestFrame4.vue +60 -0
  22. package/FlexCellDemo/TestFrame5.vue +60 -0
  23. package/FlexCellDemo/images/6.jpg +0 -0
  24. package/FocusMoveStyle/App.vue +1 -0
  25. package/FocusMoveStyle/CreepFocus.vue +11 -1
  26. package/FocusMoveStyle/FoldableItem.vue +1 -1
  27. package/FullScreenFlex/App.vue +42 -0
  28. package/FullScreenFlex/TestFrame2.vue +107 -0
  29. package/FullScreenFlex/images/1.png +0 -0
  30. package/HashHistory/App.vue +8 -4
  31. package/Input/App.vue +184 -97
  32. package/Input/InputPanel.vue +98 -82
  33. package/LatexFormula/App.vue +97 -10
  34. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +1 -1
  35. package/MetroWidgetDemos/routeList.js +17 -17
  36. package/MindMap/App.vue +10 -1
  37. package/MindMap/data.js +34 -8
  38. package/Parkour/appConfig/jsview.config.mjs +0 -4
  39. package/PosterPacker/App.vue +207 -0
  40. package/PosterPacker/images/bg.jpg +0 -0
  41. package/PosterPacker/images/blue.png +0 -0
  42. package/PosterPacker/images/darkGreen.png +0 -0
  43. package/PosterPacker/images/left.png +0 -0
  44. package/PosterPacker/images/orange.png +0 -0
  45. package/PosterPacker/images/pink.png +0 -0
  46. package/PosterPacker/images/purple.png +0 -0
  47. package/PosterPacker/images/red.png +0 -0
  48. package/PosterPacker/images/right.png +0 -0
  49. package/PosterPacker/images/yellowGreen.png +0 -0
  50. package/PosterPacker/tools/geniePakcer/Genie.vue +686 -0
  51. package/PosterPacker/tools/geniePakcer/genieBottom.glsl +49 -0
  52. package/PosterPacker/tools/geniePakcer/genieLeft.glsl +50 -0
  53. package/PosterPacker/tools/geniePakcer/genieRight.glsl +57 -0
  54. package/PosterPacker/tools/geniePakcer/genieTop.glsl +50 -0
  55. package/PosterPacker/tools/particlePacker/Particle.vue +71 -0
  56. package/PosterPacker/tools/vortexPacker/Vortex.vue +135 -0
  57. package/PosterPacker/tools/vortexPacker/vortex.glsl +37 -0
  58. package/Preload/App.vue +1 -1
  59. package/ScrollBoxTest/ClipBar.vue +1 -0
  60. package/ScrollBoxTest/NinePatchBar.vue +1 -0
  61. package/ScrollBoxTest/SizeDivBar.vue +1 -0
  62. package/SprayMove/App.vue +75 -0
  63. package/SprayMove/SprayMove.vue +173 -0
  64. package/SprayView/App.vue +8 -9
  65. package/TestNativeSharedView/App.vue +6 -4
  66. package/TextShadowDemo/App.vue +3 -3
  67. package/TextureAnimation/App.vue +244 -148
  68. package/TextureAnimation/App2.vue +66 -14
  69. package/TextureAnimation/assets/blackWhiteTurntable.png +0 -0
  70. package/TextureAnimation/assets/circleHaloMask.png +0 -0
  71. package/TouchWidget/App.vue +79 -40
  72. package/TouchWidget/Item.vue +15 -3
  73. package/index.d.ts +1 -1
  74. package/package.json +1 -1
  75. package/TextureAnimation/assets/mask.png +0 -0
  76. package/TextureAnimation/assets/php.jpg +0 -0
  77. package/TouchSample/App.vue +0 -136
  78. package/TouchSample/Item.vue +0 -102
  79. package/TouchSample/MetroWidgetHorizontal.vue +0 -144
  80. package/TouchSample/MetroWidgetVertical.vue +0 -144
  81. package/TouchSample/TouchContainerHorizontal.vue +0 -160
  82. package/TouchSample/TouchContainerVertical.vue +0 -160
  83. package/TouchSample/data.js +0 -81
  84. /package/TextureAnimation/assets/{php2.png → borderOpacity.png} +0 -0
package/Input/App.vue CHANGED
@@ -9,112 +9,199 @@
9
9
  import { InputType, EdgeDirection, useFocusHub } from "jsview";
10
10
  import InputPanel from "./InputPanel.vue";
11
11
  import { useRouter } from "vue-router";
12
- import { shallowRef } from "vue"
12
+ import { shallowRef } from "vue";
13
13
  const router = useRouter();
14
- let focusNode = shallowRef(null)
15
- const name = "/input"
16
- const focusHub = useFocusHub()
14
+ let focusNode = shallowRef(null);
15
+ const name = "/input";
16
+ const focusHub = useFocusHub();
17
17
 
18
18
  const _onKeyDown = (ev) => {
19
- if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
20
- router?.go(-1); // 有router时,是从DemoHomepage进入,回退
21
- }
22
- return true;
23
- }
19
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
20
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
21
+ }
22
+ return true;
23
+ };
24
+
25
+ const focus_name_list = [
26
+ name + "/normal-left",
27
+ name + "/normal-right",
28
+ name + "/password",
29
+ name + "/number",
30
+ ];
31
+
24
32
  const _onFocus = () => {
25
- focusHub.setFocus(name + "/normal");
26
- }
33
+ focusHub.setFocus(focus_name_list[0]);
34
+ };
35
+ const _panel0OnEdge = (edgeInfo) => {
36
+ // 自己为0
37
+ if (edgeInfo.direction == EdgeDirection.right) {
38
+ focusHub.setFocus(focus_name_list[1]);
39
+ }
40
+ };
27
41
  const _panel1OnEdge = (edgeInfo) => {
28
- if (edgeInfo.direction == EdgeDirection.right) {
29
- focusHub.setFocus(name + "/password");
30
- }
31
- }
42
+ // 自己为1
43
+ if (edgeInfo.direction == EdgeDirection.left) {
44
+ focusHub.setFocus(focus_name_list[0]);
45
+ } else if (edgeInfo.direction == EdgeDirection.right) {
46
+ focusHub.setFocus(focus_name_list[2]);
47
+ }
48
+ };
32
49
  const _panel2OnEdge = (edgeInfo) => {
33
- if (edgeInfo.direction == EdgeDirection.left) {
34
- focusHub.setFocus(name + "/normal");
35
- } else if (edgeInfo.direction == EdgeDirection.right) {
36
- focusHub.setFocus(name + "/number");
37
- }
38
- }
50
+ // 自己为2
51
+ if (edgeInfo.direction == EdgeDirection.left) {
52
+ focusHub.setFocus(focus_name_list[1]);
53
+ } else if (edgeInfo.direction == EdgeDirection.right) {
54
+ focusHub.setFocus(focus_name_list[3]);
55
+ }
56
+ };
39
57
  const _panel3OnEdge = (edgeInfo) => {
40
- if (edgeInfo.direction == EdgeDirection.left) {
41
- focusHub.setFocus(name + "/password");
42
- }
43
- }
44
-
45
-
58
+ // 自己为3
59
+ if (edgeInfo.direction == EdgeDirection.left) {
60
+ focusHub.setFocus(focus_name_list[2]);
61
+ }
62
+ };
46
63
  </script>
47
64
 
48
65
  <template>
49
- <jsv-focus-block ref="focusNode" autoFocus :onAction="{
50
- onKeyDown: _onKeyDown,
51
- onFocus: _onFocus,
52
- }" :style="{
53
- width: 1920,
54
- height: 1080,
55
- backgroundColor: '#007788',
56
- }">
57
- <div :style="{
58
- top: 100,
59
- left: 100,
60
- }">
61
- <div :style="{
62
- width: 300,
63
- height: 50,
64
- lineHeight: 50,
65
- textAlign: 'center',
66
- fontSize: 30,
67
- }">
68
- 文字输入-左对齐
69
- </div>
70
- <div :style="{
71
- top: 100,
72
- }">
73
- <input-panel :name="name + '/normal'" :type="InputType.TEXT" textAlign="left" placeholder="请输入"
74
- :onEdge="_panel1OnEdge" />
75
- </div>
76
- </div>
66
+ <jsv-focus-block
67
+ ref="focusNode"
68
+ autoFocus
69
+ :onAction="{
70
+ onKeyDown: _onKeyDown,
71
+ onFocus: _onFocus,
72
+ }"
73
+ :style="{
74
+ width: 1920,
75
+ height: 1080,
76
+ backgroundColor: '#007788',
77
+ }"
78
+ >
79
+ <div
80
+ :style="{
81
+ top: 100,
82
+ left: 100,
83
+ }"
84
+ >
85
+ <div
86
+ :style="{
87
+ width: 300,
88
+ height: 50,
89
+ lineHeight: 50,
90
+ textAlign: 'center',
91
+ fontSize: 30,
92
+ }"
93
+ >
94
+ 文字输入-左对齐
95
+ </div>
96
+ <div
97
+ :style="{
98
+ top: 100,
99
+ }"
100
+ >
101
+ <input-panel
102
+ :name="name + '/normal-left'"
103
+ :type="InputType.TEXT"
104
+ textAlign="left"
105
+ placeholder="请输入"
106
+ :onEdge="_panel0OnEdge"
107
+ />
108
+ </div>
109
+ </div>
110
+
111
+ <div
112
+ :style="{
113
+ top: 100,
114
+ left: 360,
115
+ }"
116
+ >
117
+ <div
118
+ :style="{
119
+ width: 300,
120
+ height: 50,
121
+ lineHeight: 50,
122
+ textAlign: 'center',
123
+ fontSize: 30,
124
+ }"
125
+ >
126
+ 文字输入-右对齐
127
+ </div>
128
+ <div
129
+ :style="{
130
+ top: 100,
131
+ }"
132
+ >
133
+ <input-panel
134
+ :name="name + '/normal-right'"
135
+ :type="InputType.TEXT"
136
+ textAlign="right"
137
+ placeholder="请输入"
138
+ :onEdge="_panel1OnEdge"
139
+ />
140
+ </div>
141
+ </div>
77
142
 
78
- <div :style="{
79
- top: 100,
80
- left: 500,
81
- }">
82
- <div :style="{
83
- width: 300,
84
- height: 50,
85
- lineHeight: 50,
86
- textAlign: 'center',
87
- fontSize: 30,
88
- }">
89
- 密码输入-右对齐
90
- </div>
91
- <div :style="{
92
- top: 100,
93
- }">
94
- <input-panel :name="name + '/password'" :type="InputType.PASSWORD" textAlign="right" placeholder="请输入"
95
- :onEdge="_panel2OnEdge" />
96
- </div>
97
- </div>
143
+ <div
144
+ :style="{
145
+ top: 100,
146
+ left: 630,
147
+ }"
148
+ >
149
+ <div
150
+ :style="{
151
+ width: 300,
152
+ height: 50,
153
+ lineHeight: 50,
154
+ textAlign: 'center',
155
+ fontSize: 30,
156
+ }"
157
+ >
158
+ 密码输入-右对齐
159
+ </div>
160
+ <div
161
+ :style="{
162
+ top: 100,
163
+ }"
164
+ >
165
+ <input-panel
166
+ :name="name + '/password'"
167
+ :type="InputType.PASSWORD"
168
+ textAlign="right"
169
+ placeholder="请输入"
170
+ :onEdge="_panel2OnEdge"
171
+ />
172
+ </div>
173
+ </div>
98
174
 
99
- <div :style="{
100
- top: 100,
101
- left: 900,
102
- }">
103
- <div :style="{
104
- width: 300,
105
- height: 50,
106
- lineHeight: 50,
107
- textAlign: 'center',
108
- fontSize: 30,
109
- }">
110
- 数字输入-右对齐
111
- </div>
112
- <div :style="{
113
- top: 100,
114
- }">
115
- <input-panel :name="name + '/number'" :type="InputType.NUMBER" textAlign="right" placeholder="请输入"
116
- :onEdge="_panel3OnEdge" />
117
- </div>
118
- </div>
119
- </jsv-focus-block>
120
- </template>
175
+ <div
176
+ :style="{
177
+ top: 100,
178
+ left: 900,
179
+ }"
180
+ >
181
+ <div
182
+ :style="{
183
+ width: 300,
184
+ height: 50,
185
+ lineHeight: 50,
186
+ textAlign: 'center',
187
+ fontSize: 30,
188
+ }"
189
+ >
190
+ 数字输入-右对齐
191
+ </div>
192
+ <div
193
+ :style="{
194
+ top: 100,
195
+ }"
196
+ >
197
+ <input-panel
198
+ :name="name + '/number'"
199
+ :type="InputType.NUMBER"
200
+ textAlign="right"
201
+ placeholder="请输入"
202
+ :onEdge="_panel3OnEdge"
203
+ />
204
+ </div>
205
+ </div>
206
+ </jsv-focus-block>
207
+ </template>
@@ -8,100 +8,116 @@
8
8
  <script setup>
9
9
  import FullKeyboard from "./FullKeyboard.vue";
10
10
  import { EdgeDirection, JsvInput, useFocusHub } from "jsview";
11
- import { shallowRef} from "vue";
11
+ import { shallowRef } from "vue";
12
12
 
13
13
  const blurColor = "#AAAAAA";
14
14
  const focusColor = "#FFFF00";
15
- let focusNode = shallowRef(null)
16
- let input=shallowRef(null)
17
- let showCursor = shallowRef(false)
18
- const focusHub = useFocusHub()
19
- let cursorColor = shallowRef(blurColor)
15
+ let focusNode = shallowRef(null);
16
+ let input = shallowRef(null);
17
+ let showCursor = shallowRef(false);
18
+ const focusHub = useFocusHub();
19
+ let cursorColor = shallowRef(blurColor);
20
20
  const props = defineProps({
21
- name: String,
22
- type: Number,
23
- textAlign: String,
24
- placeHolder: String,
25
- onEdge: Function,
26
- })
21
+ name: String,
22
+ type: Number,
23
+ textAlign: String,
24
+ placeHolder: String,
25
+ onEdge: Function,
26
+ });
27
27
  const _onFocus = () => {
28
- showCursor.value = true;
29
- cursorColor.value = blurColor;
30
- focusHub.setFocus(`${props.name}/keyboard`);
31
- }
28
+ showCursor.value = true;
29
+ cursorColor.value = blurColor;
30
+ focusHub.setFocus(`${props.name}/keyboard`);
31
+ };
32
32
  const _onBlur = () => {
33
- showCursor.value = false;
34
- cursorColor.value = blurColor;
35
- }
33
+ showCursor.value = false;
34
+ cursorColor.value = blurColor;
35
+ };
36
36
  const _keyboardOnClick = (item) => {
37
- const char = item.content;
38
- if (char === "删除") {
39
- input.value?.delete();
40
- } else if (char === "清空") {
41
- input.value?.clear();
42
- } else {
43
- input.value?.add(char);
44
- }
45
- }
37
+ const char = item.content;
38
+ if (char === "删除") {
39
+ input.value?.delete();
40
+ } else if (char === "清空") {
41
+ input.value?.clear();
42
+ } else {
43
+ input.value?.add(char);
44
+ }
45
+ };
46
46
  const _keyboardOnEdge = (edgeInfo) => {
47
- if (edgeInfo.direction === EdgeDirection.top) {
48
- focusHub.setFocus(`${props.name}/etext`);
49
- cursorColor.value = focusColor;
50
- } else {
51
- props.onEdge?.(edgeInfo);
52
- }
53
- }
47
+ if (edgeInfo.direction === EdgeDirection.top) {
48
+ focusHub.setFocus(`${props.name}/etext`);
49
+ cursorColor.value = focusColor;
50
+ } else {
51
+ props.onEdge?.(edgeInfo);
52
+ }
53
+ };
54
54
  const _onTextChange = (str) => {
55
- console.log(props.name + " text change:", str);
56
- }
55
+ console.log(props.name + " text change:", str);
56
+ };
57
57
  const _onTextOverflow = () => {
58
- console.log(props.name + " text overflow.");
59
- }
58
+ console.log(props.name + " text overflow.");
59
+ };
60
+ const _onBackKey = (isUp) => {
61
+ return true; // 无论是key-down还是key-up都consume,防止软键盘有时候返回会吐出导致界面回退的问题
62
+ };
60
63
  const _inputOnEdge = (edgeInfo) => {
61
- if (edgeInfo.direction === EdgeDirection.bottom) {
62
- focusHub.setFocus(`${props.name}/keyboard`);
63
- cursorColor.value = blurColor;
64
- } else {
65
- props.onEdge?.(edgeInfo);
66
- }
67
- return true;
68
- }
64
+ if (edgeInfo.direction === EdgeDirection.bottom) {
65
+ focusHub.setFocus(`${props.name}/keyboard`);
66
+ cursorColor.value = blurColor;
67
+ } else {
68
+ props.onEdge?.(edgeInfo);
69
+ }
70
+ return true;
71
+ };
69
72
  </script>
70
73
 
71
74
  <template>
72
- <jsv-focus-block :name="props.name" ref="focusNode" :onAction="{
73
- onFocus: _onFocus,
74
- onBlur: _onBlur,
75
- }">
76
- <div :style="{
77
- left: 50,
78
- top: 50,
79
- width: 150,
80
- height: 40,
81
- backgroundColor: '#33334f',
82
- }" />
83
- <jsv-input :name="`${props.name}/etext`"
84
- ref="input"
85
- :type="props.type"
86
- :left="50"
87
- :top="50"
88
- :height="40"
89
- :width="150"
90
- :placeholder="props.placeHolder"
91
- :cursorShow="showCursor"
92
- :fontStyle="{
93
- fontSize: 28,
94
- color: '#ffff00',
95
- textAlign: props.textAlign,
96
- }"
97
- :onEdge="_inputOnEdge"
98
- :cursorWidth="2"
99
- :onTextChange="_onTextChange"
100
- :onTextOverflow="_onTextOverflow"
101
- :cursorColor="cursorColor" />
75
+ <jsv-focus-block
76
+ :name="props.name"
77
+ ref="focusNode"
78
+ :onAction="{
79
+ onFocus: _onFocus,
80
+ onBlur: _onBlur,
81
+ }"
82
+ >
83
+ <div
84
+ :style="{
85
+ left: 50,
86
+ top: 50,
87
+ width: 150,
88
+ height: 40,
89
+ backgroundColor: '#33334f',
90
+ }"
91
+ />
92
+ <jsv-input
93
+ :name="`${props.name}/etext`"
94
+ ref="input"
95
+ :type="props.type"
96
+ :left="50"
97
+ :top="50"
98
+ :height="40"
99
+ :width="150"
100
+ :placeholder="props.placeHolder"
101
+ :cursorShow="showCursor"
102
+ :fontStyle="{
103
+ fontSize: 28,
104
+ color: '#ffff00',
105
+ textAlign: props.textAlign,
106
+ }"
107
+ :onEdge="_inputOnEdge"
108
+ :cursorWidth="2"
109
+ :onTextChange="_onTextChange"
110
+ :onTextOverflow="_onTextOverflow"
111
+ :cursorColor="cursorColor"
112
+ :onBackKey="_onBackKey"
113
+ />
102
114
 
103
- <div :style="{ top: 100 }">
104
- <full-keyboard :name="`${props.name}/keyboard`" :onClick="_keyboardOnClick" :onEdge="_keyboardOnEdge" />
105
- </div>
106
- </jsv-focus-block>
107
- </template>
115
+ <div :style="{ top: 100 }">
116
+ <full-keyboard
117
+ :name="`${props.name}/keyboard`"
118
+ :onClick="_keyboardOnClick"
119
+ :onEdge="_keyboardOnEdge"
120
+ />
121
+ </div>
122
+ </jsv-focus-block>
123
+ </template>
@@ -1,13 +1,16 @@
1
1
  <script setup>
2
- import { ref, onMounted } from "vue";
3
- import { JsvLatex, globalLoadJsvLatexPlugin } from "jsview";
2
+ import { ref, computed } from "vue";
3
+ import { JsvLatex, globalLoadJsvLatexPlugin, processLatexStr } from "jsview";
4
4
 
5
5
  globalLoadJsvLatexPlugin((status) => {
6
6
  console.log("load JsvLatex plugin status", status);
7
7
  });
8
8
 
9
- const latexStr = `\\begin{array}{l}
10
- 测试文字 \\forall\\varepsilon\\in\\mathbb{R}_+^*\\ \\exists\\eta>0\\ |x-x_0|\\leq\\eta\\Longrightarrow|f(x)-f(x_0)|\\leq\\varepsilon测试文字\\\\
9
+ const stringList = [
10
+ {
11
+ width: 800,
12
+ str: `\\begin{array}{l}
13
+ \\textbf{测试}文字 \\forall\\varepsilon\\in\\mathbb{R}_+^*\\ \\exists\\eta>0\\ |x-x_0|\\leq\\eta\\Longrightarrow|f(x)-f(x_0)|\\leq\\varepsilon测试文字\\\\
11
14
  测试文字\\det
12
15
  \\begin{bmatrix}
13
16
  a_{11}&a_{12}&\\cdots&a_{1n}\\\\
@@ -32,25 +35,109 @@ const latexStr = `\\begin{array}{l}
32
35
  &= \\int_a^b \\sqrt{u'(t)^2\\,\\vec{r}_u\\cdot\\vec{r}_u + 2u'(t)v'(t)\\, \\vec{r}_u\\cdot
33
36
  \\vec{r}_v+ v'(t)^2\\,\\vec{r}_v\\cdot\\vec{r}_v}\\,\\,\\, dt.
34
37
  \\end{array}\\\\
35
- \\end{array}`;
38
+ \\end{array}`,
39
+ },
40
+ {
41
+ width: 1100,
42
+ str: `要解这个方程 \\(x^2 + 2x + 1 = 9\\),我们首先将方程移项,得到:
36
43
 
37
- onMounted(() => {});
44
+ \\[x^2 + 2x + 1 - 9 = 0\\]
45
+
46
+ 简化后得到:
47
+
48
+ \\[x^2 + 2x - 8 = 0\\]
49
+
50
+ 在这个方程中,\\(a = 1\\), \\(b = 2\\), \\(c = -8\\)。代入求根公式:
51
+
52
+ \\[x = \\frac{-2 \\pm \\sqrt{2^2 - 4 \\cdot 1 \\cdot (-8)}}{2 \\cdot 1}\\]
53
+
54
+ \\[x = \\frac{-2 \\pm \\sqrt{4 + 32}}{2}\\]
55
+
56
+ \\[x = \\frac{-2 \\pm \\sqrt{36}}{2}\\]
57
+
58
+ \\[x = \\frac{-2 \\pm 6}{2}\\]
59
+ 这给出了两个解:
60
+
61
+ \\[x_1 = \\frac{-2 + 6}{2} = 2\\]
62
+
63
+ \\[x_2 = \\frac{-2 - 6}{2} = -4\\]
64
+
65
+ 所以,方程 \\(x^2 + 2x + 1 = 9\\) 的解是 \\(x = 2\\) 和 \\(x = -4\\)。`,
66
+ },
67
+ {
68
+ width: 1100,
69
+ str: `当然可以,这里有一个涉及正弦和余弦的三角函数问题:
70
+
71
+ 在一个直角三角形中,一个角的正弦值是 \\(\\frac{3}{5}\\),余弦值是 \\(\\frac{4}{5}\\)。请计算这个角的正切值和余切值。
72
+
73
+ 提示:正切值 \\(\\tan(\\theta)\\) 可以通过正弦和余弦的比值来计算,即 \\(\\tan(\\theta) = \\frac{\\sin(\\theta)}{\\cos(\\theta)}\\)。余切值 \\(\\cot(\\theta)\\) 是正切值的倒数,即 \\(\\cot(\\theta) = \\frac{1}{\\tan(\\theta)}\\)。
74
+
75
+ 请计算这个角的正切值和余切值。
76
+ \\[ \\tan(\\theta) = 0.75 \\]
77
+ \\[ \\cot(\\theta) = 1.33333333 \\]
78
+
79
+ 这个角的正切值是 \\(0.75\\),余切值是 \\(1.33333333\\)。`,
80
+ },
81
+ ];
82
+ const dataIndex = ref(0);
83
+ const width = computed(() => {
84
+ return stringList[dataIndex.value].width;
85
+ });
86
+
87
+ const latexStr = computed(() => {
88
+ const s = stringList[dataIndex.value].str;
89
+ // return s.replaceAll(/(?<!\\\\)[\n]+/g, "\\\\");
90
+ return processLatexStr(s);
91
+ });
92
+
93
+ const onKeyDown = (ev) => {
94
+ switch (ev.keyCode) {
95
+ case 37:
96
+ dataIndex.value =
97
+ dataIndex.value > 0 ? dataIndex.value - 1 : stringList.length - 1;
98
+ return true;
99
+ case 39:
100
+ dataIndex.value =
101
+ dataIndex.value < stringList.length - 1 ? dataIndex.value + 1 : 0;
102
+ return true;
103
+ default:
104
+ return false;
105
+ }
106
+ };
38
107
  </script>
39
108
  <template>
40
- <div
109
+ <jsv-focus-block
110
+ autoFocus
111
+ :onAction="{
112
+ onKeyDown,
113
+ }"
41
114
  :style="{
42
115
  width: 1280,
43
116
  height: 720,
44
117
  backgroundColor: '#007788',
45
118
  }"
46
- ></div>
119
+ ></jsv-focus-block>
47
120
  <jsv-latex
121
+ :key="dataIndex"
48
122
  :latexStr="latexStr"
49
- :left="50"
50
- :width="800"
123
+ :top="20"
124
+ :left="20"
125
+ :width="width"
51
126
  :fontSize="25"
52
127
  color="#FFFFFF"
53
128
  ></jsv-latex>
129
+ <div
130
+ :style="{
131
+ width: 300,
132
+ height: 100,
133
+ left: 900,
134
+ top: 650,
135
+ color: '#ffffff',
136
+ fontSize: 30,
137
+ }"
138
+ >
139
+ 按左右键切换内容
140
+ </div>
54
141
  </template>
55
142
 
56
143
  <style scoped>
@@ -33,7 +33,7 @@ const duration = 200;
33
33
  let timeoutHandler = -1;
34
34
 
35
35
  const animInfo = {
36
- anchor: 0,
36
+ anchor: props.query.index == 28 ? undefined : 0,
37
37
  duration: duration,
38
38
  onEnd: () => {
39
39
  console.log("resize end", props.query.index);