@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.151-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 (246) hide show
  1. package/BakeViewDemo/AnimatePic.vue +1 -1
  2. package/Basic/components/text/TextDirection.vue +7 -1
  3. package/BasicFocusControl/components/BaseBlock.vue +65 -18
  4. package/BreakRender/assets/imageList.json +235 -235
  5. package/ColorSpace/App.vue +2 -2
  6. package/CoupletsTest/App.vue +1 -1
  7. package/CoupletsTest/widget/Banger/Banger.vue +3 -3
  8. package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
  9. package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
  10. package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
  11. package/CustomShader/App.vue +4 -4
  12. package/CustomShader/gaussianBlur.glsl +1 -1
  13. package/DashPath/App.vue +80 -0
  14. package/DashPath/AppForOperator.vue +33 -0
  15. package/DemoForOperator/AnimPic/AnimPic.vue +69 -0
  16. package/DemoForOperator/AnimPic/App.vue +28 -0
  17. package/DemoForOperator/Banger/App.vue +26 -0
  18. package/DemoForOperator/Banger/Banger/Banger.vue +316 -0
  19. package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
  20. package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
  21. package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
  22. package/DemoForOperator/Blur/Blur.vue +146 -0
  23. package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
  24. package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
  25. package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
  26. package/DemoForOperator/BookFlip/App.vue +115 -0
  27. package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
  28. package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
  29. package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
  30. package/DemoForOperator/BookFlip/BookPage.vue +82 -0
  31. package/DemoForOperator/Bounce/App.vue +43 -0
  32. package/DemoForOperator/Bounce/Bounce.vue +81 -0
  33. package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
  34. package/DemoForOperator/ChunLian/App.vue +47 -0
  35. package/DemoForOperator/ChunLian/Couplets.vue +291 -0
  36. package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
  37. package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
  38. package/DemoForOperator/DominantColor/App.vue +187 -0
  39. package/DemoForOperator/EpisodeList/App.vue +80 -0
  40. package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +110 -0
  41. package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +250 -0
  42. package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
  43. package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
  44. package/DemoForOperator/Firework1/App.vue +25 -0
  45. package/DemoForOperator/Firework1/Fireworks.vue +397 -0
  46. package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
  47. package/DemoForOperator/FlipPage/App.vue +75 -0
  48. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +178 -0
  49. package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
  50. package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
  51. package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +95 -0
  52. package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
  53. package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
  54. package/DemoForOperator/Focus/App.vue +124 -0
  55. package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
  56. package/DemoForOperator/Focus/Item.vue +46 -0
  57. package/DemoForOperator/Focus/Light/Item.vue +67 -0
  58. package/DemoForOperator/Focus/Light/LightFocusBox.vue +87 -0
  59. package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
  60. package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
  61. package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
  62. package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
  63. package/DemoForOperator/Focus/Normal/Item.vue +64 -0
  64. package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +65 -0
  65. package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
  66. package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
  67. package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
  68. package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
  69. package/DemoForOperator/FrameShadow/App.vue +193 -0
  70. package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
  71. package/DemoForOperator/FullscreenIn/App.vue +105 -0
  72. package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +56 -0
  73. package/DemoForOperator/FullscreenIn/Item.vue +50 -0
  74. package/DemoForOperator/Genie/App.vue +78 -0
  75. package/DemoForOperator/Genie/geniePakcer/Genie.vue +741 -0
  76. package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
  77. package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
  78. package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
  79. package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
  80. package/DemoForOperator/GrayFilter/App.vue +51 -0
  81. package/DemoForOperator/GrayFilter/GrayFilter.vue +59 -0
  82. package/DemoForOperator/Jigsaw/App.vue +45 -0
  83. package/DemoForOperator/Jigsaw/JigsawFull.vue +142 -0
  84. package/DemoForOperator/Jigsaw/JigsawSingle.vue +118 -0
  85. package/DemoForOperator/LongChatBox/App.vue +36 -0
  86. package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
  87. package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
  88. package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
  89. package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
  90. package/DemoForOperator/LongChatBox/testData.js +51 -0
  91. package/DemoForOperator/LongChatBox/utile.js +331 -0
  92. package/DemoForOperator/Particle/App.vue +69 -0
  93. package/DemoForOperator/Particle/Drop/DropParticle.vue +208 -0
  94. package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +120 -0
  95. package/DemoForOperator/PosterAnim/App.vue +125 -0
  96. package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
  97. package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
  98. package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
  99. package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
  100. package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
  101. package/DemoForOperator/PosterAnim/Item.vue +46 -0
  102. package/DemoForOperator/PosterAnim/PosterAnim.js +79 -0
  103. package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
  104. package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
  105. package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
  106. package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
  107. package/DemoForOperator/PosterOverflow/App.vue +116 -0
  108. package/DemoForOperator/PosterOverflow/Item.vue +67 -0
  109. package/DemoForOperator/PosterOverflow/PosterOverflow.vue +39 -0
  110. package/DemoForOperator/Resize/App.vue +157 -0
  111. package/DemoForOperator/Resize/Resize/Item.vue +234 -0
  112. package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
  113. package/DemoForOperator/Ripple/App.vue +54 -0
  114. package/DemoForOperator/Ripple/Ripple.vue +65 -0
  115. package/DemoForOperator/ScreenShootScale/App.vue +96 -0
  116. package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
  117. package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
  118. package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
  119. package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
  120. package/DemoForOperator/SmoothSwiper/App.vue +50 -0
  121. package/DemoForOperator/Sound/Bounce/App.vue +56 -0
  122. package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
  123. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
  124. package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
  125. package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
  126. package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
  127. package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
  128. package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
  129. package/DemoForOperator/Sound/Rain/App.vue +11 -0
  130. package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
  131. package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
  132. package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
  133. package/DemoForOperator/Sound/Sound/index.js +4 -0
  134. package/DemoForOperator/Sound/Sound/useSound.js +112 -0
  135. package/DemoForOperator/Sprite/App.vue +33 -0
  136. package/DemoForOperator/Sprite/Sprite.vue +147 -0
  137. package/DemoForOperator/Stretch/App.vue +103 -0
  138. package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
  139. package/DemoForOperator/Stretch/Stretch/Stretch.vue +218 -0
  140. package/DemoForOperator/Swiper/App.vue +101 -0
  141. package/DemoForOperator/Swiper/Item.vue +56 -0
  142. package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
  143. package/DemoForOperator/TabContent/App.vue +89 -0
  144. package/DemoForOperator/TabContent/ContentPage.vue +66 -0
  145. package/DemoForOperator/TabContent/Item.vue +85 -0
  146. package/DemoForOperator/TabContent/PageItem.vue +40 -0
  147. package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
  148. package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
  149. package/DemoForOperator/TabContent/TabContent/TabContent.vue +184 -0
  150. package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
  151. package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
  152. package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
  153. package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
  154. package/DemoForOperator/TabContent/testData.js +241 -0
  155. package/DemoForOperator/TabContentVertical/App.vue +104 -0
  156. package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
  157. package/DemoForOperator/TabContentVertical/Item.vue +94 -0
  158. package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
  159. package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
  160. package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
  161. package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
  162. package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
  163. package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
  164. package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
  165. package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
  166. package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
  167. package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
  168. package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
  169. package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
  170. package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
  171. package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
  172. package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
  173. package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
  174. package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
  175. package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
  176. package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
  177. package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
  178. package/DemoForOperator/TabContentVertical/testData.js +76 -0
  179. package/DemoForOperator/Vortex/App.vue +78 -0
  180. package/DemoForOperator/Vortex/Vortex/Vortex.vue +180 -0
  181. package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
  182. package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
  183. package/DemoForOperator/index.js +6 -0
  184. package/DemoForOperator/routeList.js +259 -0
  185. package/DemoHomepage/App.vue +50 -30
  186. package/DemoHomepage/components/Dialog.vue +1 -0
  187. package/DemoHomepage/components/Item.vue +11 -0
  188. package/DemoHomepage/components/TabFrame.vue +7 -0
  189. package/DemoHomepage/router.js +178 -81
  190. package/DemoHomepage/views/Homepage.vue +7 -2
  191. package/DivMetroPerformance/data.js +3 -3
  192. package/DriftScopeTest/App.vue +1 -1
  193. package/FilterDemo/AnimatePic.vue +1 -1
  194. package/FilterDemo/VideoLayer.vue +2 -2
  195. package/FullScreenFlex/TestFrame2.vue +1 -1
  196. package/GiftRain/App.vue +12 -12
  197. package/GiftRain/components/SpriteTranslate.vue +68 -48
  198. package/HashHistory/App.vue +2 -2
  199. package/HashHistory/router.js +1 -1
  200. package/JsvPreDownloader/App.vue +4 -4
  201. package/MediaDemo/components/frames/AudioFrame.vue +1 -1
  202. package/MediaDemo/components/frames/VideoFrame.vue +1 -1
  203. package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
  204. package/MetroWidgetDemos/MassiveItems/data.js +1 -1
  205. package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
  206. package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
  207. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
  208. package/MetroWidgetDemos/TripleWidget/App.vue +7 -1
  209. package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
  210. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
  211. package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
  212. package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
  213. package/MetroWidgetDemos/routeList.js +34 -17
  214. package/Poster3d/App.vue +69 -0
  215. package/Poster3d/Poster3d.vue +92 -0
  216. package/PosterPacker/App.vue +5 -5
  217. package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
  218. package/QrcodeDemo/App.vue +1 -1
  219. package/Ripple/App.vue +1 -1
  220. package/ScaleDownNeon/App.vue +4 -4
  221. package/SceneTransition/App.vue +2 -2
  222. package/SceneTransition/maskConfig/config2.js +12 -12
  223. package/SceneTransition/maskConfig/config3.js +14 -14
  224. package/SprayView/App.vue +96 -51
  225. package/SpringFestival/App.vue +73 -0
  226. package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
  227. package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
  228. package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
  229. package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
  230. package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
  231. package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
  232. package/SpringFestival/SpringFestivalScene/index.js +1 -0
  233. package/Swiper/App.vue +28 -29
  234. package/Swiper/Item.vue +19 -0
  235. package/SwiperTest/App.vue +9 -9
  236. package/TestNativeSharedView/AckEventDefine.ts +82 -0
  237. package/TestNativeSharedView/App.vue +4 -6
  238. package/TestNativeSharedView/JsvDemoTester.js +131 -0
  239. package/TextureAnimation/App.vue +16 -6
  240. package/TextureAnimation/App3.vue +100 -0
  241. package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
  242. package/TextureAnimation/utils/RotateFrame.vue +146 -0
  243. package/TextureAnimation/utils/circleHaloMask.png +0 -0
  244. package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
  245. package/ViewOpacity/App.vue +21 -2
  246. package/package.json +1 -1
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <jsv-preload
3
+ key="preload"
4
+ :preloadList="[preloadInfo]"
5
+ :onPreloadDone="handlePreloadDone"
6
+ ></jsv-preload>
7
+ <jsv-texture-anim
8
+ v-if="isPreloadDone"
9
+ ref="pandaAnim"
10
+ :src="props.imgUrl"
11
+ :width="props.width"
12
+ :height="props.height"
13
+ :animation="appliedAnim"
14
+ :duration="props.duration"
15
+ :transform="appliedTrans"
16
+ :borderRadius="props.borderRadius"
17
+ :autoStart="false"
18
+ :easing="props.easing"
19
+ :onAnimationEnd="onAnimEnd"
20
+ ></jsv-texture-anim>
21
+ </template>
22
+
23
+ <script setup>
24
+ import { ref, shallowRef, computed } from "vue";
25
+ import { JsvPreload, buildPreloadInfo } from "jsview";
26
+ import { JsvTextureAnim } from "jsview";
27
+
28
+ const props = defineProps({
29
+ imgUrl: {
30
+ type: String,
31
+ required: true,
32
+ },
33
+ width: {
34
+ type: Number,
35
+ required: true,
36
+ },
37
+ height: {
38
+ type: Number,
39
+ required: true,
40
+ },
41
+ collapseWidth: {
42
+ type: Number,
43
+ required: true,
44
+ },
45
+ duration: {
46
+ type: Number,
47
+ default: 200,
48
+ },
49
+ easing: {
50
+ type: String,
51
+ default: "linear",
52
+ },
53
+ borderRadius: {
54
+ type: Number,
55
+ default: 0,
56
+ },
57
+ /**
58
+ * 初始位置
59
+ * @type {"left" | "right" | "center"}
60
+ */
61
+ initPosition: {
62
+ type: String,
63
+ default: "center",
64
+ },
65
+ });
66
+
67
+ const isPreloadDone = ref(false);
68
+ const preloadInfo = buildPreloadInfo(props.imgUrl);
69
+
70
+ const pandaAnim = shallowRef(null);
71
+
72
+ const imageW = ref(0);
73
+ const imageH = ref(0);
74
+ const imageRatio = computed(() => imageW.value / imageH.value);
75
+
76
+ const imageShowWidth = computed(() => props.height * imageRatio.value);
77
+ const offset = computed(() => (imageShowWidth.value - props.width) / 2);
78
+
79
+ const baseScale = computed(
80
+ () => `scale3d(${imageShowWidth.value / props.width}, 1, 1)`
81
+ );
82
+ // const baseScale = computed(
83
+ // () => `rotate3d(0,0,1,45deg)`
84
+ // );
85
+
86
+ const leftTranslate = computed(
87
+ () =>
88
+ `translate3d(${
89
+ ((props.width - props.collapseWidth - -offset.value) / props.width) * 100
90
+ }%, 0, 0) ${baseScale.value}`
91
+ );
92
+ const rightTranslate = computed(
93
+ () =>
94
+ `translate3d(${
95
+ ((-(imageShowWidth.value - props.collapseWidth) - -offset.value) /
96
+ props.width) *
97
+ 100
98
+ }%, 0, 0) ${baseScale.value}`
99
+ );
100
+ const centerTranslate = computed(() => `translate3d(0,0,0) ${baseScale.value}`);
101
+ const curPosition = ref(props.initPosition);
102
+
103
+ const transform = computed(
104
+ () =>
105
+ (curPosition.value === "left"
106
+ ? leftTranslate.value
107
+ : curPosition.value === "right"
108
+ ? rightTranslate.value
109
+ : centerTranslate.value)
110
+ );
111
+ const appliedTrans = ref(null);
112
+ const appliedAnim = ref(null);
113
+
114
+ //TODO JsvPreload 的回调会执行多次,所以需要一个标志来判断是否已经执行过
115
+ let loadDone = false;
116
+ const handlePreloadDone = (resultMap) => {
117
+ if (loadDone) return;
118
+ loadDone = true;
119
+ console.log("ccht 图片预加载完成", resultMap);
120
+ imageW.value = resultMap[props.imgUrl].width;
121
+ imageH.value = resultMap[props.imgUrl].height;
122
+ appliedTrans.value = transform.value;
123
+ isPreloadDone.value = true;
124
+ };
125
+
126
+ let onAnimEnd = (normalEnd) => {
127
+ console.log("ccht 动画结束", transform.value);
128
+ if (normalEnd) {
129
+ appliedTrans.value = transform.value;
130
+ }
131
+ appliedAnim.value = null;
132
+ };
133
+
134
+ let translateMap = {
135
+ left: leftTranslate,
136
+ right: rightTranslate,
137
+ center: centerTranslate,
138
+ };
139
+ /**
140
+ * 滑动
141
+ * @param {"left" | "right" | "center"} to 结束位置
142
+ */
143
+ function slide(to) {
144
+ if (
145
+ curPosition.value === to ||
146
+ (curPosition.value === "left" && to === "right") ||
147
+ (curPosition.value === "right" && to === "left")
148
+ ) {
149
+ console.warn(`滑动失败,当前位置:${curPosition.value},目标位置:${to}`);
150
+ return;
151
+ }
152
+ appliedTrans.value = null;
153
+ appliedAnim.value = `{from {transform: ${
154
+ translateMap[curPosition.value].value
155
+ };} to {transform: ${translateMap[to].value};}}`;
156
+ console.log("ccht slide ", curPosition.value, to, appliedAnim.value);
157
+ curPosition.value = to;
158
+ pandaAnim.value?.start(appliedAnim.value);
159
+ }
160
+
161
+ defineExpose({
162
+ slide,
163
+ });
164
+ </script>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ width: 1280,
5
+ height: 720,
6
+ backgroundColor: '#007788',
7
+ }"
8
+ ></div>
9
+ <tab-content
10
+ :name="name"
11
+ :data="testData"
12
+ :tabLayout="{ width: 1200, height: 90 }"
13
+ :tabPadding="{ left: 20, right: 20, top: 20, height: 20 }"
14
+ :contentLayout="{ left: 20, top: 100, width: 1280, height: 500 }"
15
+ :tagItemGap="10"
16
+ :contentDataLoader="pageDataLoader"
17
+ :initFocusId="2"
18
+ :contentOnFocus="contentOnFocus"
19
+ :contentOnBlur="contentOnBlur"
20
+ creepFocusColor="#e26c44"
21
+ >
22
+ <template #tabItem="{ data, onAction, query }">
23
+ <item :data="data" :onAction="onAction" :query="query"></item>
24
+ </template>
25
+ <template #content="{ data, onEdge }">
26
+ <content-page
27
+ name="contentPage"
28
+ :pageData="data"
29
+ :onEdge="onEdge"
30
+ ></content-page>
31
+ </template>
32
+ </tab-content>
33
+ </template>
34
+
35
+ <script setup>
36
+ import TabContent from "./TabContent/TabContent.vue";
37
+ import { onMounted } from "vue";
38
+ import { useFocusHub } from "jsview";
39
+ /** 注意, tab数据中有子tab的, 子tab的数据必须在childTab字段下, 类似这里的testData */
40
+ import { testData } from "./testData.js";
41
+ import Item from "./Item.vue";
42
+ import ContentPage from "./ContentPage.vue";
43
+
44
+ const focusHub = useFocusHub();
45
+ const name = "tab-content";
46
+
47
+ const ironmanSmall =
48
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/PosterOverflow/App/ironman_small.png";
49
+ const spidermanSmall =
50
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/PosterOverflow/App/spiderman_small.png";
51
+ const captainSmall =
52
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/PosterOverflow/App/captain_small.png";
53
+
54
+ async function pageDataLoader(tabId) {
55
+ return {
56
+ title: "page " + tabId,
57
+ list: [
58
+ {
59
+ width: 370,
60
+ height: 300,
61
+ img: ironmanSmall,
62
+ },
63
+ {
64
+ width: 370,
65
+ height: 300,
66
+ img: spidermanSmall,
67
+ },
68
+ {
69
+ width: 370,
70
+ height: 300,
71
+ img: captainSmall,
72
+ },
73
+ ],
74
+ };
75
+ }
76
+
77
+ function contentOnFocus() {
78
+ console.log("content on focus");
79
+ focusHub.setFocus("contentPage");
80
+ }
81
+
82
+ function contentOnBlur() {
83
+ console.log("content on blur");
84
+ }
85
+
86
+ onMounted(() => {
87
+ focusHub.setFocus(name);
88
+ });
89
+ </script>
@@ -0,0 +1,66 @@
1
+ <script setup>
2
+ import { MetroWidget, HORIZONTAL, useFocusHub } from "jsview";
3
+ import { ref, onMounted } from "vue";
4
+ import PageItem from "./PageItem.vue";
5
+
6
+ const props = defineProps({
7
+ pageData: Object,
8
+ name: String,
9
+ onEdge: Function,
10
+ });
11
+
12
+ console.log("content page on edge", props.pageData);
13
+
14
+ const provideData = () => {
15
+ return props.pageData.list;
16
+ };
17
+
18
+ const measures = (data) => {
19
+ return {
20
+ width: data.width,
21
+ height: data.height,
22
+ marginRight: 20,
23
+ };
24
+ };
25
+
26
+ const widgetLayout = {
27
+ left: 0,
28
+ top: 80,
29
+ width: 1280,
30
+ height: 400,
31
+ };
32
+
33
+ onMounted(() => {});
34
+ </script>
35
+
36
+ <template>
37
+ <div
38
+ :style="{
39
+ fontSize: 40,
40
+ width: 1280,
41
+ height: 80,
42
+ color: '#FFFFFF',
43
+ }"
44
+ >
45
+ {{ pageData.title }}
46
+ </div>
47
+
48
+ <metro-widget
49
+ :name="name"
50
+ :left="widgetLayout.left"
51
+ :top="widgetLayout.top"
52
+ :width="widgetLayout.width"
53
+ :height="widgetLayout.height"
54
+ :provideData="provideData"
55
+ :direction="HORIZONTAL"
56
+ :measures="measures"
57
+ :onEdge="onEdge"
58
+ :padding="{ left: 40, right: 40, top: 50, bottom: 50 }"
59
+ >
60
+ <template #renderItem="{ data, onAction }">
61
+ <page-item :data="data" :onAction="onAction" />
62
+ </template>
63
+ </metro-widget>
64
+ </template>
65
+
66
+ <style scoped></style>
@@ -0,0 +1,85 @@
1
+ <script setup>
2
+ import { ref, inject, shallowRef, onMounted, computed } from "vue";
3
+ const modeIsKey = inject("modeIsKey");
4
+ const tabFocus = inject("tabFocus");
5
+ const globalInfo = inject("globalInfo");
6
+ const colorList = ["#FFD700", "#FF1493", "#1E90FF"];
7
+ const props = defineProps({
8
+ data: Object,
9
+ query: Object,
10
+ onAction: Object,
11
+ });
12
+
13
+ const focused = ref(false);
14
+ const divRef = shallowRef();
15
+
16
+ const onFocus = () => {
17
+ focused.value = true;
18
+ };
19
+
20
+ const onBlur = () => {
21
+ focused.value = false;
22
+ };
23
+
24
+ const onClicked = () => {
25
+ console.log("item clicked", props.data);
26
+ };
27
+
28
+ const onGaze = () => {};
29
+
30
+ const onIgnore = () => {};
31
+
32
+ const isSlect = computed(() => {
33
+ if (modeIsKey()) {
34
+ return (
35
+ !tabFocus.value &&
36
+ !focused.value &&
37
+ globalInfo.updateTabId == props.data.indexId
38
+ );
39
+ } else {
40
+ return globalInfo.updateTabId == props.data.indexId;
41
+ }
42
+ });
43
+
44
+ props.onAction.register("onFocus", onFocus);
45
+ props.onAction.register("onBlur", onBlur);
46
+ props.onAction.register("onClick", onClicked);
47
+ props.onAction.register("onGaze", onGaze);
48
+ props.onAction.register("onIgnore", onIgnore);
49
+
50
+ // indexId为4时,是有子tab的电影tab
51
+ const fontSize = computed(() => {
52
+ return props.data.isSubTab && props.data.indexId != 4 ? 26 : 30;
53
+ });
54
+ const fontWeight = computed(() => {
55
+ return props.data.isSubTab && props.data.indexId != 4 ? "bold" : null;
56
+ });
57
+ const textColor = computed(() => {
58
+ return props.data.isSubTab && props.data.indexId != 4
59
+ ? colorList[props.data.indexId % 3]
60
+ : "#ffffff";
61
+ });
62
+
63
+ onMounted(() => {});
64
+ </script>
65
+
66
+ <template>
67
+ <div
68
+ :style="{
69
+ fontSize: fontSize,
70
+ width: data.width,
71
+ height: data.height,
72
+ color: textColor,
73
+ backgroundColor: isSlect ? 'rgba(211,115,78,0.4)' : 'rgba(0,0,0,0)',
74
+ borderRadius: 15,
75
+ textAlign: 'center',
76
+ lineHeight: data.height,
77
+ transform: focused ? 'scale3d(1.1,1.1,1)' : 'scale3d(1,1,1)',
78
+ fontWeight: fontWeight,
79
+ }"
80
+ >
81
+ {{ data.content }}
82
+ </div>
83
+ </template>
84
+
85
+ <style scoped></style>
@@ -0,0 +1,40 @@
1
+ <script setup>
2
+ import { ref } from "vue";
3
+
4
+ const props = defineProps({
5
+ data: Object,
6
+ onAction: Object,
7
+ });
8
+
9
+ const focused = ref(false);
10
+
11
+ // 注册回调
12
+ const onFocus = () => {
13
+ focused.value = true;
14
+ };
15
+
16
+ const onBlur = () => {
17
+ focused.value = false;
18
+ };
19
+
20
+ const onClick = () => {
21
+ console.log("page item clicked:", props.data);
22
+ };
23
+
24
+ props.onAction.register("onFocus", onFocus);
25
+ props.onAction.register("onBlur", onBlur);
26
+ props.onAction.register("onClick", onClick);
27
+ </script>
28
+
29
+ <template>
30
+ <div
31
+ :style="{
32
+ width: data.width,
33
+ height: data.height,
34
+ backgroundImage: `url(${data.img})`,
35
+ borderRadius: 15,
36
+ transform: focused ? 'scale3d(1.1, 1.1, 1)' : 'scale3d(1, 1, 1)',
37
+ transition: 'transform 0.2s',
38
+ }"
39
+ />
40
+ </template>
@@ -0,0 +1,160 @@
1
+ <script setup>
2
+ import { JsvNinePatch, getKeyFramesGroup, JsvTextureStoreApi } from "jsview";
3
+ import { reactive, onBeforeUnmount, ref } from "vue";
4
+
5
+ const props = defineProps({
6
+ color: {
7
+ type: String,
8
+ default: "#e26c44" // 默认橙色,完全不透明
9
+ },
10
+ borderWidth: {
11
+ type: Number,
12
+ default: 3 // 边框宽度
13
+ },
14
+ initWidth: {
15
+ type: Number,
16
+ default: 0,
17
+ },
18
+ initHeight: {
19
+ type: Number,
20
+ default: 0,
21
+ },
22
+ initLeft: {
23
+ type: Number,
24
+ default: 0,
25
+ },
26
+ initTop: {
27
+ type: Number,
28
+ default: 0,
29
+ },
30
+ });
31
+
32
+ // 创建圆形纹理
33
+ const sourceId = ref('');
34
+ const circleSize = 35; // 保持原有imageWidth的大小
35
+ const canvasRef = JsvTextureStoreApi.canvasTexture(
36
+ circleSize,
37
+ circleSize
38
+ );
39
+
40
+ // 创建圆形路径
41
+ const radius = Math.floor(circleSize / 2);
42
+ const customPath = canvasRef.circlePath(
43
+ radius,
44
+ radius,
45
+ radius - props.borderWidth/2
46
+ );
47
+
48
+ // 设置透明背景
49
+ canvasRef.drawColor("rgba(0,0,0,0)");
50
+
51
+ // 绘制圆形边框
52
+ customPath?.fill(props.color);
53
+
54
+ // 提交并获取纹理ID
55
+ sourceId.value = canvasRef.commit();
56
+
57
+ const styleShell = getKeyFramesGroup();
58
+
59
+ const animationCache = {};
60
+ const addAnimation = (fromRect, toRect, name) => {
61
+ if (animationCache.hasOwnProperty(name)) {
62
+ styleShell?.removeRule(name);
63
+ delete animationCache[name];
64
+ }
65
+ if (!(name in animationCache)) {
66
+ const animStr = `@keyframes ${name} {
67
+ 0% {
68
+ left: ${fromRect.left};
69
+ top: ${fromRect.top};
70
+ width: ${fromRect.width};
71
+ height: ${fromRect.height};
72
+ }
73
+ 50% {
74
+ left: ${Math.min(fromRect.left, toRect.left)};
75
+ top: ${Math.min(fromRect.top, toRect.top)};
76
+ width: ${
77
+ Math.max(fromRect.left + fromRect.width, toRect.left + toRect.width) -
78
+ Math.min(fromRect.left, toRect.left)
79
+ };
80
+ height: ${
81
+ Math.max(fromRect.top + fromRect.height, toRect.top + toRect.height) -
82
+ Math.min(fromRect.top, toRect.top)
83
+ };
84
+ }
85
+ 100% {
86
+ left: ${toRect.left};
87
+ top: ${toRect.top};
88
+ width: ${toRect.width};
89
+ height: ${toRect.height};
90
+ }
91
+ }`;
92
+ animationCache[name] = animStr;
93
+ styleShell.insertRule(animStr);
94
+ }
95
+ };
96
+ const removeAnimation = (name) => {
97
+ styleShell?.removeRule(name);
98
+ };
99
+
100
+ const focusSize = reactive({
101
+ width: props.initWidth,
102
+ height: props.initHeight,
103
+ left: props.initLeft,
104
+ top: props.initTop,
105
+ animation: null,
106
+ onTransitionEnd: null,
107
+ });
108
+
109
+ let animateChange = 0; // A B版动画切换,解决animation属性不变化引起不刷新问题
110
+ let preRect = null;
111
+ let curRect = null;
112
+ let first = true;
113
+
114
+ const changeRect = (rect, doAnim = true) => {
115
+ preRect = curRect;
116
+ curRect = rect;
117
+ if (first) {
118
+ first = false;
119
+ } else if (doAnim) {
120
+ const animName = "test_focusMove_" + animateChange;
121
+ animateChange = animateChange == 0 ? 1 : 0; // A B 版切换
122
+ addAnimation(preRect, curRect, animName);
123
+ focusSize.animation = `${animName} 0.3s linear`;
124
+ }
125
+ focusSize.left = curRect.left;
126
+ focusSize.top = curRect.top;
127
+ focusSize.width = curRect.width;
128
+ focusSize.height = curRect.height;
129
+ };
130
+
131
+ onBeforeUnmount(() => {
132
+ for (let name in animationCache) {
133
+ removeAnimation(name);
134
+ }
135
+ JsvTextureStoreApi.deleteTexture(sourceId.value);
136
+ });
137
+
138
+ defineExpose({
139
+ changeRect,
140
+ });
141
+ </script>
142
+
143
+ <template>
144
+ <jsv-nine-patch
145
+ :style="{
146
+ width: focusSize.width,
147
+ height: focusSize.height,
148
+ top: focusSize.top,
149
+ left: focusSize.left,
150
+ }"
151
+ :animation="focusSize.animation"
152
+ :imageUrl="`jsvtexturestore://${sourceId}`"
153
+ :imageWidth="circleSize"
154
+ :centerWidth="2"
155
+ :imageDspWidth="circleSize"
156
+ :borderOutset="borderWidth"
157
+ :animTime="0.2"
158
+ :waitForInit="true"
159
+ ></jsv-nine-patch>
160
+ </template>
@@ -0,0 +1,63 @@
1
+ <script setup>
2
+ import { onMounted } from "vue";
3
+ const props = defineProps({
4
+ data: Object,
5
+ query: Object,
6
+ onEdge: Function,
7
+ onAction: Object,
8
+ onItemFocus: Function,
9
+ focusRectController: {
10
+ type: Object,
11
+ },
12
+ onItemClick: Function,
13
+ });
14
+
15
+ const customCallbacks = {};
16
+ const selfOnAction = {
17
+ register: (name, func) => {
18
+ customCallbacks[name] = func;
19
+ },
20
+ unregister: (name) => {
21
+ delete customCallbacks[name];
22
+ },
23
+ };
24
+
25
+ const onFocus = (params) => {
26
+ const rect = props.query.templatePosition(props.query.index);
27
+ props.focusRectController?.onFocusChange(rect);
28
+ props.onItemFocus?.(props.data, rect);
29
+ customCallbacks.onFocus?.(params);
30
+ };
31
+
32
+ const onBlur = () => {
33
+ customCallbacks.onBlur?.();
34
+ };
35
+
36
+ const onClicked = () => {
37
+ console.log("item clicked", props.data);
38
+ props.onItemClick?.(props.data);
39
+ customCallbacks.onClick?.();
40
+ };
41
+
42
+ const onGaze = () => {
43
+ customCallbacks.onGaze?.();
44
+ };
45
+
46
+ const onIgnore = () => {
47
+ customCallbacks.onIgnore?.();
48
+ };
49
+
50
+ props.onAction.register("onFocus", onFocus);
51
+ props.onAction.register("onBlur", onBlur);
52
+ props.onAction.register("onClick", onClicked);
53
+ props.onAction.register("onGaze", onGaze);
54
+ props.onAction.register("onIgnore", onIgnore);
55
+
56
+ onMounted(() => {});
57
+ </script>
58
+
59
+ <template>
60
+ <slot name="tabItem" :data="data" :query="query" :onAction="selfOnAction"></slot>
61
+ </template>
62
+
63
+ <style scoped></style>