@shijiu/jsview-vue-samples 2.3.151-test.0 → 3.0.0-test.0

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 (228) hide show
  1. package/ABImageAlt/App.vue +114 -0
  2. package/ABImageAlt/Item.vue +133 -0
  3. package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
  4. package/ABImageAlt/data.js +17 -0
  5. package/AI_Check_Rules.txt +5 -0
  6. package/AnimPicture/App.vue +20 -10
  7. package/ApicSwitch/App.vue +90 -0
  8. package/ApicSwitch/TabItem.vue +65 -0
  9. package/ApicSwitch/WebpShow.vue +24 -0
  10. package/ApicSwitch/data.js +50 -0
  11. package/Basic/AI_skills_update.md +1 -0
  12. package/Basic/components/div/ColorFormatTest.vue +93 -0
  13. package/Basic/components/div/DivRadius.vue +97 -15
  14. package/Basic/components/div/DivTag3Group.vue +30 -0
  15. package/Basic/components/img/ImageType.vue +65 -0
  16. package/Basic/components/panel/Panel2.vue +13 -1
  17. package/Basic/components/text/TextAlign.vue +7 -1
  18. package/BlobLoadTest/App.vue +201 -0
  19. package/BreakLinesApi/App.vue +82 -0
  20. package/CanvasDrawChart/App.vue +11 -0
  21. package/CanvasDrawChart/Graph1.vue +104 -0
  22. package/CanvasDrawChart/Graph2.vue +115 -0
  23. package/CssPreprocessor/Scss/PanelData.js +1 -1
  24. package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +4 -3
  25. package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +2 -2
  26. package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
  27. package/DemoForOperator/Firework1/App.vue +12 -1
  28. package/DemoForOperator/Firework1/Fireworks.vue +18 -0
  29. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +1 -0
  30. package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
  31. package/DemoForOperator/Focus/Light/Item.vue +1 -0
  32. package/DemoForOperator/Focus/Normal/Item.vue +1 -0
  33. package/DemoForOperator/FrameShadow/FrameShadow.vue +1 -1
  34. package/DemoForOperator/Genie/App.vue +20 -6
  35. package/DemoForOperator/Genie/App2.vue +61 -0
  36. package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
  37. package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
  38. package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
  39. package/DemoForOperator/Jigsaw/JigsawFull.vue +12 -7
  40. package/DemoForOperator/Jigsaw/JigsawSingle.vue +13 -7
  41. package/DemoForOperator/LongChatBox/App.vue +13 -13
  42. package/DemoForOperator/LongChatBox/Bubble.vue +78 -66
  43. package/DemoForOperator/LongChatBox/LongChat.vue +68 -36
  44. package/DemoForOperator/LongChatBox/testData.js +7 -44
  45. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +1 -1
  46. package/DemoForOperator/routeList.js +8 -2
  47. package/DemoHomepage/App.vue +74 -1
  48. package/DemoHomepage/components/BodyFrame.vue +1 -0
  49. package/DemoHomepage/components/TabFrame.vue +1 -1
  50. package/DemoHomepage/router.js +723 -160
  51. package/DemoHomepage/views/Homepage.vue +60 -2
  52. package/DemoHomepage/watchTest.vue +50 -0
  53. package/FilterDemo/AnimatePic.vue +63 -17
  54. package/FilterDemo/App.vue +3 -3
  55. package/FlexCellDemo/AI_skills_update.md +4 -0
  56. package/FlexCellDemo/TestFrame1.vue +12 -2
  57. package/FlexCellDemo/TestFrame2.vue +10 -1
  58. package/FlexCellDemo/TestFrame3.vue +114 -59
  59. package/FpsLimit/App.vue +102 -0
  60. package/FreeMoveChildAttract/App.vue +18 -8
  61. package/FreeMoveLink/App.vue +49 -20
  62. package/Hover/App.vue +144 -0
  63. package/HttpRequestSSE/SSEReader.js +200 -0
  64. package/ImpactStop/App.vue +2 -2
  65. package/Input/FullKeyboard.vue +3 -3
  66. package/Input/InputPanel.vue +63 -3
  67. package/JsvLine/App.vue +53 -38
  68. package/LatexDemo/App.vue +3 -1
  69. package/LatexFormula/App.vue +196 -0
  70. package/LongImage/App.vue +1 -1
  71. package/LongImage/LongImageScroll.vue +100 -47
  72. package/LongImage/Scroll.vue +28 -9
  73. package/LongText/LongTextScroll.vue +1 -0
  74. package/Markdown/App.vue +36 -0
  75. package/Markdown/Bubble.vue +109 -0
  76. package/Markdown/LongChat.vue +206 -0
  77. package/Markdown/Markdown/Markdown.vue +156 -0
  78. package/Markdown/Markdown/index.ts +1 -0
  79. package/Markdown/Markdown/marked/LICENSE.md +45 -0
  80. package/Markdown/Markdown/marked/index.ts +2 -0
  81. package/Markdown/Markdown/marked/marked.d.ts +756 -0
  82. package/Markdown/Markdown/marked/marked.js +71 -0
  83. package/Markdown/Markdown/parser.ts +1365 -0
  84. package/Markdown/data.js +581 -0
  85. package/MetroWidgetDemos/AI_skills_update.md +2 -0
  86. package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
  87. package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
  88. package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
  89. package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
  90. package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
  91. package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
  92. package/MetroWidgetDemos/ListExpand/index.vue +88 -0
  93. package/MetroWidgetDemos/ListExpand/list.js +2421 -0
  94. package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
  95. package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
  96. package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
  97. package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
  98. package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
  99. package/MetroWidgetDemos/RenderAccelerate/Item.vue +67 -0
  100. package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
  101. package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
  102. package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
  103. package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
  104. package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
  105. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
  106. package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
  107. package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
  108. package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
  109. package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
  110. package/MetroWidgetDemos/{TripleWidget → SpatialNav}/Item.vue +1 -8
  111. package/MetroWidgetDemos/{TripleWidget/WidgetItem.vue → SpatialNav/SimpleFloor.vue} +14 -45
  112. package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
  113. package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
  114. package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
  115. package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
  116. package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
  117. package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
  118. package/MetroWidgetDemos/basic2/App.vue +407 -0
  119. package/MetroWidgetDemos/basic2/Item.vue +68 -0
  120. package/MetroWidgetDemos/direction/App.vue +22 -0
  121. package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
  122. package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
  123. package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
  124. package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
  125. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +22 -7
  126. package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
  127. package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
  128. package/MetroWidgetDemos/routeList.js +203 -12
  129. package/MetroWidgetDemos/slideSetting/App.vue +288 -99
  130. package/MetroWidgetDemos/zIndex/App.vue +117 -0
  131. package/MetroWidgetDemos/zIndex/Item.vue +61 -0
  132. package/NinePatchTester/App.vue +24 -31
  133. package/PreDecode/App.vue +140 -0
  134. package/ReactiveTest/App.vue +115 -0
  135. package/ReactiveTest/Item.vue +92 -0
  136. package/ReactiveTest/assets/imageList.js +245 -0
  137. package/ReactiveTest/component/TestSmartDiv.vue +50 -0
  138. package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
  139. package/ReactiveTest/component/TestSmartImage.vue +46 -0
  140. package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
  141. package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
  142. package/ReactiveTest/data.js +49 -0
  143. package/ScreenToBlob/App.vue +250 -0
  144. package/SecTorTest/App.vue +9 -3
  145. package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
  146. package/SyncDecode/App.vue +137 -0
  147. package/TextSizeLimit/App.vue +211 -0
  148. package/TransitPage/App.vue +2 -0
  149. package/assets/logo.png +0 -0
  150. package/package.json +5 -5
  151. package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -741
  152. package/DemoForOperator/LongChatBox/TextManager.ts +0 -147
  153. package/DemoForOperator/LongChatBox/VirtualList.vue +0 -298
  154. package/DemoForOperator/LongChatBox/utile.js +0 -331
  155. package/DivMetroPerformance/App.vue +0 -157
  156. package/DivMetroPerformance/Item.vue +0 -58
  157. package/DivMetroPerformance/assets/bg.jpg +0 -0
  158. package/DivMetroPerformance/assets/coupon_content.png +0 -0
  159. package/DivMetroPerformance/assets/coupon_left.png +0 -0
  160. package/DivMetroPerformance/assets/coupon_mid.png +0 -0
  161. package/DivMetroPerformance/assets/coupon_right.png +0 -0
  162. package/DivMetroPerformance/assets/focus_border.png +0 -0
  163. package/DivMetroPerformance/assets/holder_logo.png +0 -0
  164. package/DivMetroPerformance/assets/jrbm.png +0 -0
  165. package/DivMetroPerformance/assets/line_left.png +0 -0
  166. package/DivMetroPerformance/assets/line_mid.png +0 -0
  167. package/DivMetroPerformance/assets/line_right.png +0 -0
  168. package/DivMetroPerformance/assets/loading.png +0 -0
  169. package/DivMetroPerformance/assets/logo.png +0 -0
  170. package/DivMetroPerformance/assets/mcjx.png +0 -0
  171. package/DivMetroPerformance/assets/tao.png +0 -0
  172. package/DivMetroPerformance/assets/tmall.png +0 -0
  173. package/DivMetroPerformance/border.png +0 -0
  174. package/DivMetroPerformance/components/ContentItem.vue +0 -384
  175. package/DivMetroPerformance/components/MyTab.vue +0 -129
  176. package/DivMetroPerformance/data.js +0 -124
  177. package/DivMetroPerformance/utils/GridItem.vue +0 -28
  178. package/DivMetroPerformance/utils/GridPlate.vue +0 -85
  179. package/MediaDemo/App.vue +0 -127
  180. package/MediaDemo/assets/audio-poster.png +0 -0
  181. package/MediaDemo/components/Button.vue +0 -69
  182. package/MediaDemo/components/Controllor.vue +0 -286
  183. package/MediaDemo/components/StatusBar.vue +0 -100
  184. package/MediaDemo/components/frames/AudioFrame.vue +0 -39
  185. package/MediaDemo/components/frames/AudioPoster.vue +0 -48
  186. package/MediaDemo/components/frames/MediaFrame.vue +0 -153
  187. package/MediaDemo/components/frames/VideoFrame.vue +0 -39
  188. package/MetroWidgetDemos/TripleWidget/App.vue +0 -87
  189. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -99
  190. package/Parkour/App.vue +0 -13
  191. package/Parkour/Common/Context.js +0 -21
  192. package/Parkour/Common/MatchmanInfo.js +0 -62
  193. package/Parkour/Common/Random.js +0 -61
  194. package/Parkour/Common/Sound.js +0 -50
  195. package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
  196. package/Parkour/appConfig/app.config.mjs +0 -5
  197. package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
  198. package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
  199. package/Parkour/appConfig/jsview.config.mjs +0 -39
  200. package/Parkour/assets/Bgimages/bg1.png +0 -0
  201. package/Parkour/assets/Bgimages/bg2.png +0 -0
  202. package/Parkour/assets/Bgimages/bg3.png +0 -0
  203. package/Parkour/assets/Bgimages/bg4.png +0 -0
  204. package/Parkour/assets/Bgimages/bg5.png +0 -0
  205. package/Parkour/assets/audio/jump.mp3 +0 -0
  206. package/Parkour/assets/audio/lose.mp3 +0 -0
  207. package/Parkour/assets/role_skin1/fail.json +0 -44
  208. package/Parkour/assets/role_skin1/fail.png +0 -0
  209. package/Parkour/assets/role_skin1/jump_down.json +0 -20
  210. package/Parkour/assets/role_skin1/jump_down.png +0 -0
  211. package/Parkour/assets/role_skin1/jump_up.json +0 -44
  212. package/Parkour/assets/role_skin1/jump_up.png +0 -0
  213. package/Parkour/assets/role_skin1/roll.json +0 -44
  214. package/Parkour/assets/role_skin1/roll.png +0 -0
  215. package/Parkour/assets/role_skin1/run.json +0 -52
  216. package/Parkour/assets/role_skin1/run.png +0 -0
  217. package/Parkour/components/Backdrop.vue +0 -61
  218. package/Parkour/components/GameSence.vue +0 -602
  219. package/Parkour/components/Matchman.vue +0 -85
  220. package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
  221. package/ThrowMoveDemo/App.vue +0 -104
  222. package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
  223. package/ThrowMoveDemo/TargetDemo.vue +0 -87
  224. package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
  225. /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
  226. /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
  227. /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
  228. /package/{AnimPicture/assets → assets}/quan.webp +0 -0
@@ -8,7 +8,7 @@
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 { computed, shallowRef } from "vue";
12
12
 
13
13
  const blurColor = "#AAAAAA";
14
14
  const focusColor = "#FFFF00";
@@ -17,6 +17,8 @@ let input = shallowRef(null);
17
17
  let showCursor = shallowRef(false);
18
18
  const focusHub = useFocusHub();
19
19
  let cursorColor = shallowRef(blurColor);
20
+ let imeAction = shallowRef(null);
21
+ let imeActionColor = shallowRef("#ffffff");
20
22
  const props = defineProps({
21
23
  name: String,
22
24
  type: Number,
@@ -24,6 +26,44 @@ const props = defineProps({
24
26
  placeHolder: String,
25
27
  onEdge: Function,
26
28
  });
29
+ const _randomHexColor = () => {
30
+ const r = Math.floor(Math.random() * 256)
31
+ .toString(16)
32
+ .padStart(2, "0");
33
+ const g = Math.floor(Math.random() * 256)
34
+ .toString(16)
35
+ .padStart(2, "0");
36
+ const b = Math.floor(Math.random() * 256)
37
+ .toString(16)
38
+ .padStart(2, "0");
39
+ return `#${r}${g}${b}`;
40
+ };
41
+ const _imeActionLabel = (action) => {
42
+ switch (action) {
43
+ case 0:
44
+ return "UNSPECIFIED";
45
+ case 1:
46
+ return "NONE";
47
+ case 2:
48
+ return "GO";
49
+ case 3:
50
+ return "SEARCH";
51
+ case 4:
52
+ return "SEND";
53
+ case 5:
54
+ return "NEXT";
55
+ case 6:
56
+ return "DONE";
57
+ case 7:
58
+ return "PREVIOUS";
59
+ default:
60
+ return "UNKNOWN";
61
+ }
62
+ };
63
+ const imeActionInfo = computed(() => {
64
+ if (imeAction.value === null || imeAction.value === undefined) return "-";
65
+ return `${imeAction.value} (${_imeActionLabel(imeAction.value)})`;
66
+ });
27
67
  const _onFocus = () => {
28
68
  showCursor.value = true;
29
69
  cursorColor.value = blurColor;
@@ -58,7 +98,13 @@ const _onTextOverflow = () => {
58
98
  console.log(props.name + " text overflow.");
59
99
  };
60
100
  const _onBackKey = (isUp) => {
61
- return true; // 无论是key-down还是key-up都consume,防止软键盘有时候返回会吐出导致界面回退的问题
101
+ // 无论是key-down还是key-up都consume,防止软键盘有时候用返回键关闭时引起界面退出的问题
102
+ return true;
103
+ };
104
+ const _onImeAction = (action) => {
105
+ imeAction.value = action;
106
+ imeActionColor.value = _randomHexColor();
107
+ console.log(props.name + " ime action:", action);
62
108
  };
63
109
  const _inputOnEdge = (edgeInfo) => {
64
110
  if (edgeInfo.direction === EdgeDirection.bottom) {
@@ -110,9 +156,23 @@ const _inputOnEdge = (edgeInfo) => {
110
156
  :onTextOverflow="_onTextOverflow"
111
157
  :cursorColor="cursorColor"
112
158
  :onBackKey="_onBackKey"
159
+ :onImeAction="_onImeAction"
113
160
  />
114
161
 
115
- <div :style="{ top: 100 }">
162
+ <div
163
+ :style="{
164
+ left: 50,
165
+ top: 95,
166
+ width: 300,
167
+ height: 20,
168
+ color: imeActionColor,
169
+ fontSize: 16,
170
+ }"
171
+ >
172
+ IME action: {{ imeActionInfo }}
173
+ </div>
174
+
175
+ <div :style="{ top: 110 }">
116
176
  <full-keyboard
117
177
  :name="`${props.name}/keyboard`"
118
178
  :onClick="_keyboardOnClick"
package/JsvLine/App.vue CHANGED
@@ -16,60 +16,75 @@
16
16
  </template>
17
17
 
18
18
  <script setup>
19
+ import { shallowRef, onMounted, onBeforeUnmount } from "vue"
19
20
  import { JsvLine } from "jsview"
20
21
  import bg from "./bgimage.jpg"
21
22
 
22
- const startPos1={
23
- x:340,
24
- y:40
23
+ const startPos1 = {
24
+ x: 340,
25
+ y: 40
25
26
  }
26
- const endPos1={
27
- x:340,
28
- y:160
27
+ const endPos1 = {
28
+ x: 340,
29
+ y: 160
29
30
  }
30
31
 
31
- const startPos2={
32
- x:840,
33
- y:150
34
- }
35
- const endPos2={
36
- x:1040,
37
- y:50
38
- }
32
+ // 修改为响应式并定时切换
33
+ const states = [
34
+ { start: { x: 840, y: 150 }, end: { x: 1040, y: 50 } },
35
+ { start: { x: 840, y: 150 }, end: { x: 1140, y: 100 } }
36
+ ];
37
+ const startPos2 = shallowRef({ ...states[0].start });
38
+ const endPos2 = shallowRef({ ...states[0].end });
39
+
40
+ let posIndex = 0;
41
+ let timer = null;
42
+
43
+ onMounted(() => {
44
+ timer = setInterval(() => {
45
+ posIndex = (posIndex + 1) % states.length;
46
+ startPos2.value = { ...states[posIndex].start };
47
+ endPos2.value = { ...states[posIndex].end };
48
+ }, 1500);
49
+ });
50
+ onBeforeUnmount(() => {
51
+ clearInterval(timer);
52
+ });
39
53
 
40
- const startPos3={
41
- x:340,
42
- y:300
54
+ // 其它样例保持不变
55
+ const startPos3 = {
56
+ x: 340,
57
+ y: 300
43
58
  }
44
- const endPos3={
45
- x:560,
46
- y:400
59
+ const endPos3 = {
60
+ x: 560,
61
+ y: 400
47
62
  }
48
63
 
49
- const startPos4={
50
- x:760,
51
- y:400
64
+ const startPos4 = {
65
+ x: 760,
66
+ y: 400
52
67
  }
53
- const endPos4={
54
- x:980,
55
- y:300
68
+ const endPos4 = {
69
+ x: 980,
70
+ y: 300
56
71
  }
57
72
 
58
- const startPos5={
59
- x:240,
60
- y:550
73
+ const startPos5 = {
74
+ x: 240,
75
+ y: 550
61
76
  }
62
- const endPos5={
63
- x:500,
64
- y:520
77
+ const endPos5 = {
78
+ x: 500,
79
+ y: 520
65
80
  }
66
- const startPos6={
67
- x:840,
68
- y:520
81
+ const startPos6 = {
82
+ x: 840,
83
+ y: 520
69
84
  }
70
- const endPos6={
71
- x:1100,
72
- y:550
85
+ const endPos6 = {
86
+ x: 1100,
87
+ y: 550
73
88
  }
74
89
  </script>
75
90
 
package/LatexDemo/App.vue CHANGED
@@ -10,6 +10,8 @@ const baseStyle = {
10
10
 
11
11
  //TODO 此字符串直接写在双花括号内编译出错, 待调查
12
12
  const text = "测试\\textcolor{#FF0000}{红色并且\\textb{加粗}}文字";
13
+
14
+ const testText = `测试\\textcolor{#FF0000}{{红色}试花括号{ 文字 }}文字`
13
15
  </script>
14
16
 
15
17
  <template>
@@ -19,7 +21,7 @@ const text = "测试\\textcolor{#FF0000}{红色并且\\textb{加粗}}文字";
19
21
  :style="{ top: 50, ...baseStyle }"
20
22
  class="textStyle"
21
23
  >
22
- {{ "测试\\textcolor{#FF0000}{红色}文字" }}
24
+ {{ testText }}
23
25
  </jsv-text-box>
24
26
  <jsv-text-box
25
27
  :enableLatex="true"
@@ -78,8 +78,189 @@ const stringList = [
78
78
 
79
79
  这个角的正切值是 \\(0.75\\),余切值是 \\(1.33333333\\)。`,
80
80
  },
81
+ {
82
+ width: 1100,
83
+ detail: '说明:超长的公式文本不会描画',
84
+ str: `
85
+ 测试\\\\
86
+ 测试\\\\
87
+ 测试\\\\
88
+ 测试\\\\
89
+ 测试\\\\
90
+ 测试\\\\
91
+ 测试\\\\
92
+ 测试\\\\
93
+ 测试\\\\
94
+ 测试\\\\
95
+ 测试\\\\
96
+ 测试\\\\
97
+ 测试\\\\
98
+ 测试\\\\
99
+ 测试\\\\
100
+ 测试\\\\
101
+ 测试\\\\
102
+ 测试\\\\
103
+ 测试\\\\
104
+ 测试\\\\
105
+ 测试\\\\
106
+ 测试\\\\
107
+ 测试\\\\
108
+ 测试\\\\
109
+ 测试\\\\
110
+ 测试\\\\
111
+ 测试\\\\
112
+ 测试\\\\
113
+ 测试\\\\
114
+ 测试\\\\
115
+ 测试\\\\
116
+ 测试\\\\
117
+ 测试\\\\
118
+ 测试\\\\
119
+ 测试\\\\
120
+ 测试\\\\
121
+ 测试\\\\
122
+ 测试\\\\
123
+ 测试\\\\
124
+ 测试\\\\
125
+ 测试\\\\
126
+ 测试\\\\
127
+ 测试\\\\
128
+ 测试\\\\
129
+ 测试\\\\
130
+ 测试\\\\
131
+ 测试\\\\
132
+ 测试\\\\
133
+ 测试\\\\
134
+ 测试\\\\
135
+ 测试\\\\
136
+ 测试\\\\
137
+ 测试\\\\
138
+ 测试\\\\
139
+ 测试\\\\
140
+ 测试\\\\
141
+ 测试\\\\
142
+ 测试\\\\
143
+ 测试\\\\
144
+ 测试\\\\
145
+ 测试\\\\
146
+ 测试\\\\
147
+ 测试\\\\
148
+ 测试\\\\
149
+ 测试\\\\
150
+ 测试\\\\
151
+ 测试\\\\
152
+ 测试\\\\
153
+ 测试\\\\
154
+ 测试\\\\
155
+ 测试\\\\
156
+ 测试\\\\
157
+ 测试\\\\
158
+ 测试\\\\
159
+ 测试\\\\
160
+ 测试\\\\
161
+ 测试\\\\
162
+ 测试\\\\
163
+ 测试\\\\
164
+ 测试\\\\
165
+ 测试\\\\
166
+ 测试\\\\
167
+ 测试\\\\
168
+ 测试\\\\
169
+ 测试\\\\
170
+ 测试\\\\
171
+ 测试\\\\
172
+ 测试\\\\
173
+ 测试\\\\
174
+ 测试\\\\
175
+ 测试\\\\
176
+ 测试\\\\
177
+ 测试\\\\
178
+ 测试\\\\
179
+ 测试\\\\
180
+ 测试\\\\
181
+ 测试\\\\
182
+ 测试\\\\
183
+ 测试\\\\
184
+ 测试\\\\
185
+ 测试\\\\
186
+ 测试\\\\
187
+ 测试\\\\
188
+ 测试\\\\
189
+ 测试\\\\
190
+ 测试\\\\
191
+ 测试\\\\
192
+ 测试\\\\
193
+ 测试\\\\
194
+ 测试\\\\
195
+ 测试\\\\
196
+ 测试\\\\
197
+ 测试\\\\
198
+ 测试\\\\
199
+ 测试\\\\
200
+ 测试\\\\
201
+ 测试\\\\
202
+ 测试\\\\
203
+ 测试\\\\
204
+ 测试\\\\
205
+ 测试\\\\
206
+ 测试\\\\
207
+ 测试\\\\
208
+ 测试\\\\
209
+ 测试\\\\
210
+ 测试\\\\
211
+ 测试\\\\
212
+ 测试\\\\
213
+ 测试\\\\
214
+ 测试\\\\
215
+ 测试\\\\
216
+ 测试\\\\
217
+ 测试\\\\
218
+ 测试\\\\
219
+ 测试\\\\
220
+ 测试\\\\
221
+ 测试\\\\
222
+ 测试\\\\
223
+ 测试\\\\
224
+ 测试\\\\
225
+ 测试\\\\
226
+ 测试\\\\
227
+ 测试\\\\
228
+ 测试\\\\
229
+ 测试\\\\
230
+ 测试\\\\
231
+ 测试\\\\
232
+ 测试\\\\
233
+ 测试\\\\
234
+ 测试\\\\
235
+ 测试\\\\
236
+ 测试\\\\
237
+ 测试\\\\
238
+ 测试\\\\
239
+ 测试\\\\
240
+ 测试\\\\
241
+ 测试\\\\
242
+ 测试\\\\
243
+ 测试\\\\
244
+ 测试\\\\
245
+ 测试\\\\
246
+ 测试\\\\
247
+ 测试\\\\
248
+ 测试\\\\
249
+ 测试\\\\
250
+ 测试\\\\
251
+ 测试\\\\
252
+ 测试\\\\
253
+ 测试\\\\
254
+ 测试\\\\
255
+ 测试\\\\
256
+ 测试\\\\
257
+ 测试\\\\
258
+ 测试\\\\
259
+ 测试\\\\`,
260
+ },
81
261
  ];
82
262
  const dataIndex = ref(0);
263
+ const testDetail = ref("");
83
264
  const width = computed(() => {
84
265
  return stringList[dataIndex.value].width;
85
266
  });
@@ -90,6 +271,10 @@ const latexStr = computed(() => {
90
271
  return processLatexStr(s);
91
272
  });
92
273
 
274
+ const detail = computed(() => {
275
+ return stringList[dataIndex.value].detail || '';
276
+ });
277
+
93
278
  const onKeyDown = (ev) => {
94
279
  switch (ev.keyCode) {
95
280
  case 37:
@@ -117,6 +302,17 @@ const onKeyDown = (ev) => {
117
302
  backgroundColor: '#007788',
118
303
  }"
119
304
  ></jsv-focus-block>
305
+ <div
306
+ :style="{
307
+ width: 320,
308
+ left: 1280 - 320,
309
+ top: 30,
310
+ height: 200,
311
+ fontSize: 20,
312
+ }"
313
+ >
314
+ {{ detail }}
315
+ </div>
120
316
  <jsv-latex
121
317
  :key="dataIndex"
122
318
  :latexStr="latexStr"
package/LongImage/App.vue CHANGED
@@ -4,7 +4,7 @@
4
4
  * 带下拉条的长图片展示样例
5
5
  *
6
6
  * 【控件介绍】
7
- * SimpleWidget:见simpleMetrowidget
7
+ * MetroWidget:见MetroWidget.vue的头说明
8
8
  *
9
9
  * 【技巧说明】
10
10
  * Q: 如何让图片的高度自适应?
@@ -1,7 +1,13 @@
1
1
  <script setup>
2
2
  import Scroll from "./Scroll.vue";
3
3
  import { ref, shallowRef, onMounted } from "vue";
4
- import { useFocusHub } from "jsview";
4
+ import {
5
+ useFocusHub,
6
+ JsvFlexDiv,
7
+ VERTICAL,
8
+ JsvScrollBox,
9
+ ScrollBoxStyle,
10
+ } from "jsview";
5
11
 
6
12
  const props = defineProps({
7
13
  step: Number,
@@ -11,41 +17,48 @@ const props = defineProps({
11
17
  imageSrc: String,
12
18
  });
13
19
 
14
- const focusHub = useFocusHub();
15
- const element = shallowRef(null);
20
+
21
+ const rootRef = ref(null);
22
+ const element = ref(null);
16
23
  const scrollY = ref(0);
17
- const textY = ref(0);
24
+
25
+ const focusHub = useFocusHub();
26
+
27
+ let imageY = 0;
28
+ let rScrollHeight = shallowRef(0);
29
+ let rJsvScrollBox = shallowRef(null);
30
+ let imageTotalHeight = 0;
31
+ const onSizeReady = (width, height) => {
32
+ imageTotalHeight = height;
33
+ rScrollHeight.value = height;
34
+ console.log(`size ready width=${width} height=${height}`);
35
+ };
36
+
18
37
  const onAction = {
19
38
  onKeyDown: (ev) => {
20
- const valid =
21
- element.value &&
22
- element.value.clientHeight &&
23
- element.value.clientHeight > props.style.height;
39
+ const valid = element.value && imageTotalHeight > 0;
24
40
  // let keyUsed = true;
25
41
  if (valid) {
26
- let text_y;
42
+ // 测试用比对代码,正式场景不需要
43
+ // if (imageTotalHeight != element.value.clientHeight) {
44
+ // console.error("Error: height miss match");
45
+ // }
46
+
47
+ let image_y;
27
48
  switch (ev.keyCode) {
28
49
  case 38:
29
- if (textY.value !== 0) {
30
- text_y =
31
- textY.value + props.step >= 0 ? 0 : textY.value + props.step;
32
- (textY.value = text_y),
33
- (scrollY.value =
34
- (-text_y / (element.value.clientHeight - props.style.height)) *
35
- (props.scrollStyle.height - props.scrollBlockStyle.height));
50
+ if (imageY !== 0) {
51
+ image_y = imageY + props.step >= 0 ? 0 : imageY + props.step;
52
+ slideToYByKey(image_y);
36
53
  }
37
54
  break;
38
55
  case 40:
39
- if (textY.value !== props.style.height - element.value.clientHeight) {
40
- text_y =
41
- textY.value - props.step <=
42
- props.style.height - element.value.clientHeight
43
- ? props.style.height - element.value.clientHeight
44
- : textY.value - props.step;
45
- (textY.value = text_y),
46
- (scrollY.value =
47
- (-text_y / (element.value.clientHeight - props.style.height)) *
48
- (props.scrollStyle.height - props.scrollBlockStyle.height));
56
+ if (imageY !== props.style.height - imageTotalHeight) {
57
+ image_y =
58
+ imageY - props.step <= props.style.height - imageTotalHeight
59
+ ? props.style.height - imageTotalHeight
60
+ : imageY - props.step;
61
+ slideToYByKey(image_y);
49
62
  } else {
50
63
  focusHub.setFocus("button");
51
64
  }
@@ -53,35 +66,75 @@ const onAction = {
53
66
  }
54
67
  }
55
68
  },
56
- onFocus: () => {
57
- console.log("LongImageScroll getFocus");
58
- },
59
- onBlur: () => {
60
- console.log("LongImageScroll loseFocus");
61
- },
62
69
  };
70
+ function slideToYByKey(newY) {
71
+ // 使用新的Y来调整ScrollBox的显示位置
72
+ rJsvScrollBox.value.updatePercent(
73
+ -newY / (imageTotalHeight - props.style.height)
74
+ );
63
75
 
64
- const onLoad = () => {
65
- // 图片加载完成的回调
66
- console.log("Image loaded!");
67
- };
76
+ recordY(newY);
77
+
78
+ // 不再直接更新右边进度条的进度
79
+ // 将由 JsvScrollBox 的syncWith机制来同步
80
+ // 注意: 目前这个机制在PC上没有模拟,
81
+ // 如果PC上也需要看到同步效果,则可通过 window.JsView 是否存在来识别非盒子情况,此时主动改变bar的top
82
+ }
83
+
84
+ function recordY(newY) {
85
+ // 记录text Y,为为下次按键的基准坐标
86
+ imageY = newY;
87
+ }
68
88
 
69
89
  onMounted(() => {
70
- focusHub.setFocus("longImageScroll");
90
+ rootRef.value.requestFocus();
91
+
92
+ // 检测滚动触控触发的移动,
93
+ // 当 updatePercent 调用后如果移动距离大于阈值也会回调
94
+ rJsvScrollBox.value.setSensor((percent, x, y) => {
95
+ let newY = Math.floor(y);
96
+ console.log(
97
+ `onProgress dragged percent=${percent} x=${Math.floor(x)} y=${newY}`
98
+ );
99
+ recordY(newY);
100
+ }, 15 /* 每动15px才接收一次通知,减少js被调用的频率,从而减小对性能的影响 */);
71
101
  });
72
102
  </script>
73
103
 
74
-
75
104
  <template>
76
- <jsv-focus-block name="longImageScroll" :onAction="onAction">
105
+
106
+ <jsv-focus-block ref="rootRef" name="longImageScroll" :onAction="onAction">
77
107
  <div :style="{ overflow: 'hidden', ...style }">
78
- <img
79
- alt=""
80
- ref="element"
81
- :src="imageSrc"
82
- :style="{ top: textY, width: style.width }"
83
- :onLoad="onLoad"
84
- />
108
+ <jsv-scroll-box
109
+ ref="rJsvScrollBox"
110
+ linkName="ScrollBoxTextArea"
111
+ syncWith="ScrollBarTextArea"
112
+ :style="{
113
+ width: style.width,
114
+ height: style.height,
115
+ }"
116
+ :direction="VERTICAL"
117
+ :mode="ScrollBoxStyle.DrawerMode"
118
+ :enableFling="true"
119
+ :sliderSize="{
120
+ height: rScrollHeight == 0 ? style.height : rScrollHeight,
121
+ }"
122
+ :enableMouseWheel="true"
123
+ >
124
+ <template #SliderBox>
125
+ <jsv-flex-div
126
+ :style="{ width: style.width }"
127
+ :onSized="onSizeReady"
128
+ >
129
+ <img
130
+ alt=""
131
+ ref="element"
132
+ :src="imageSrc"
133
+ :style="{ top: imageY, width: style.width }"
134
+ />
135
+ </jsv-flex-div>
136
+ </template>
137
+ </jsv-scroll-box>
85
138
  </div>
86
139
  <Scroll
87
140
  :top="scrollY"
@@ -89,4 +142,4 @@ onMounted(() => {
89
142
  :scrollBlockStyle="scrollBlockStyle"
90
143
  />
91
144
  </jsv-focus-block>
92
- </template>
145
+ </template>
@@ -1,14 +1,33 @@
1
- <script setup>
2
- defineProps({
1
+ <script setup lang="ts">
2
+ import { VERTICAL, JsvScrollBox, SeamlessSlide, ScrollBoxStyle } from "jsview";
3
+
4
+ let rProps = defineProps({
3
5
  scrollStyle: Object,
4
- top: Number,
5
6
  scrollBlockStyle: Object,
6
7
  });
8
+
9
+ let { left: cScrollLeft, ...cScrollSubStyle } = rProps.scrollStyle as any;
7
10
  </script>
8
11
  <template>
9
- <div :style="{ ...scrollStyle }">
10
- <div :style="{ top: top }">
11
- <div :style="{ ...scrollBlockStyle }"></div>
12
- </div>
13
- </div>
14
- </template>
12
+ <jsv-scroll-box
13
+ linkName="ScrollBarTextArea"
14
+ syncWith="ScrollBoxTextArea"
15
+ :style="{
16
+ left: cScrollLeft,
17
+ width: cScrollSubStyle.width,
18
+ height: cScrollSubStyle.height,
19
+ }"
20
+ :direction="VERTICAL"
21
+ :mode="ScrollBoxStyle.PinMode"
22
+ :sliderSize="{
23
+ height: (rProps.scrollBlockStyle as any).height,
24
+ }"
25
+ >
26
+ <template #FixedBox>
27
+ <div :style="{ ...cScrollSubStyle }" />
28
+ </template>
29
+ <template #SliderBox>
30
+ <div :style="{ ...rProps.scrollBlockStyle }" />
31
+ </template>
32
+ </jsv-scroll-box>
33
+ </template>
@@ -124,6 +124,7 @@ onMounted(() => {
124
124
  :sliderSize="{
125
125
  height: rScrollHeight == 0 ? style.height : rScrollHeight,
126
126
  }"
127
+ :enableMouseWheel="true"
127
128
  >
128
129
  <template #SliderBox>
129
130
  <jsv-flex-div