@shijiu/jsview-vue 0.9.502 → 0.9.631

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 (240) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/target_core_revision.js +4 -3
  4. package/index.js +10 -0
  5. package/package.json +8 -1
  6. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +16 -5
  7. package/samples/AnimPicture/App.vue +89 -106
  8. package/samples/Basic/App.vue +65 -68
  9. package/samples/Basic/components/ContentBlock.vue +31 -36
  10. package/samples/Basic/components/anim/AnimGroup.vue +61 -75
  11. package/samples/Basic/components/anim/AnimKeyframeBasic.vue +54 -43
  12. package/samples/Basic/components/anim/AnimKeyframeComposite.vue +25 -31
  13. package/samples/Basic/components/anim/AnimTransition.vue +142 -105
  14. package/samples/Basic/components/div/DivBackground.vue +38 -16
  15. package/samples/Basic/components/div/DivClip.vue +143 -78
  16. package/samples/Basic/components/div/DivCssScoped.vue +10 -10
  17. package/samples/Basic/components/div/DivCssVar.vue +40 -42
  18. package/samples/Basic/components/div/DivGroup1.vue +45 -39
  19. package/samples/Basic/components/div/DivGroup2.vue +56 -45
  20. package/samples/Basic/components/div/DivLayout.vue +63 -5
  21. package/samples/Basic/components/div/DivRadius.vue +51 -42
  22. package/samples/Basic/components/div/DivTransform.vue +21 -16
  23. package/samples/Basic/components/panel/Panel1.vue +46 -44
  24. package/samples/Basic/components/panel/Panel2.vue +22 -26
  25. package/samples/Basic/components/panel/TitleBar.vue +12 -12
  26. package/samples/Basic/components/text/TextAlign.vue +54 -44
  27. package/samples/Basic/components/text/TextEmoji.vue +16 -20
  28. package/samples/Basic/components/text/TextFontStyle.vue +77 -53
  29. package/samples/Basic/components/text/TextGroup1.vue +46 -38
  30. package/samples/Basic/components/text/TextGroup2.vue +25 -28
  31. package/samples/Basic/components/text/TextOverflow.vue +78 -59
  32. package/samples/BasicFocusControl/App.vue +22 -43
  33. package/samples/BasicFocusControl/components/BaseBlock.vue +42 -43
  34. package/samples/BasicFocusControl/components/MainArea.vue +55 -70
  35. package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +11 -15
  36. package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +21 -24
  37. package/samples/BasicFocusControl/components/SideBar.vue +32 -47
  38. package/samples/BasicFocusControl/components/SideBarBlock.vue +20 -23
  39. package/samples/Collision/App.vue +452 -0
  40. package/samples/ColorSpace/App.vue +15 -24
  41. package/samples/DemoHomepage/App.vue +7 -11
  42. package/samples/DemoHomepage/components/BodyFrame.vue +21 -9
  43. package/samples/DemoHomepage/components/TabFrame.vue +7 -8
  44. package/samples/DemoHomepage/router.js +52 -33
  45. package/samples/DemoHomepage/views/Homepage.vue +18 -9
  46. package/samples/FilterDemo/AnimatePic.vue +58 -0
  47. package/samples/FilterDemo/App.vue +99 -61
  48. package/samples/FilterDemo/VideoLayer.vue +62 -0
  49. package/samples/FlipCard/App.vue +32 -41
  50. package/samples/FlipCard/FlipCard.vue +48 -54
  51. package/samples/GridDemo/App.vue +109 -77
  52. package/samples/GridDemo/ButtonBlock.vue +50 -49
  53. package/samples/GridDemo/FocusItem.vue +19 -38
  54. package/samples/GridDemo/Item.vue +46 -54
  55. package/samples/HashHistory/App.vue +63 -79
  56. package/samples/HashHistory/components/HorizontalButtonList.vue +72 -95
  57. package/samples/HashHistory/components/Item.vue +42 -56
  58. package/samples/HashHistory/router.js +23 -12
  59. package/samples/HashHistory/views/MainPage.vue +35 -46
  60. package/samples/HashHistory/views/SubPage.vue +34 -47
  61. package/samples/ImpactStop/App.vue +435 -0
  62. package/samples/Input/App.vue +8 -18
  63. package/samples/Input/FullKeyboard.vue +2 -6
  64. package/samples/Input/InputPanel.vue +18 -12
  65. package/samples/Input/KeyboardItem.vue +1 -1
  66. package/samples/LongImage/App.vue +11 -27
  67. package/samples/LongImage/Button.vue +50 -145
  68. package/samples/LongImage/ButtonItem.vue +44 -0
  69. package/samples/LongImage/LongImageScroll.vue +71 -106
  70. package/samples/LongImage/Scroll.vue +7 -9
  71. package/samples/LongText/App.vue +13 -28
  72. package/samples/LongText/Button.vue +43 -145
  73. package/samples/LongText/ButtonItem.vue +44 -0
  74. package/samples/LongText/LongTextScroll.vue +68 -101
  75. package/samples/LongText/Scroll.vue +7 -9
  76. package/samples/Marquee/App.vue +34 -37
  77. package/samples/MaskClip/App.vue +17 -30
  78. package/samples/MetroWidgetDemos/Advanced/App.vue +47 -0
  79. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
  80. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
  81. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
  82. package/samples/MetroWidgetDemos/Advanced/Widgets.vue +71 -0
  83. package/samples/MetroWidgetDemos/Item.vue +67 -0
  84. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/App.vue +80 -104
  85. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/Item.vue +7 -0
  86. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/bg.jpg +0 -0
  87. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png +0 -0
  88. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_left.png +0 -0
  89. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_mid.png +0 -0
  90. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_right.png +0 -0
  91. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/focus_border.png +0 -0
  92. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/holder_logo.png +0 -0
  93. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/jrbm.png +0 -0
  94. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_left.png +0 -0
  95. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_mid.png +0 -0
  96. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_right.png +0 -0
  97. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/loading.png +0 -0
  98. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/logo.png +0 -0
  99. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/mcjx.png +0 -0
  100. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tao.png +0 -0
  101. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tmall.png +0 -0
  102. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/border.png +0 -0
  103. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/ContentItem.vue +60 -86
  104. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/MyTab.vue +0 -0
  105. package/samples/MetroWidgetDemos/PerformanceTest/data.js +45 -0
  106. package/samples/MetroWidgetDemos/PingPong/App.vue +135 -0
  107. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
  108. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
  109. package/samples/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
  110. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
  111. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
  112. package/samples/MetroWidgetDemos/Simple/App.vue +45 -0
  113. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
  114. package/samples/MetroWidgetDemos/WidgetItem.vue +89 -0
  115. package/samples/MetroWidgetDemos/data.js +204 -0
  116. package/samples/NinePatchDemo/App.vue +114 -115
  117. package/samples/NinePatchDemo/Item.vue +7 -8
  118. package/samples/Preload/App.vue +67 -64
  119. package/samples/Preload/Item.vue +21 -29
  120. package/samples/QrcodeDemo/App.vue +24 -29
  121. package/samples/SoundPool/App.vue +77 -106
  122. package/samples/SprayView/App.vue +10 -8
  123. package/samples/SpriteImage/App.vue +1 -2
  124. package/samples/TextBox/App.vue +86 -101
  125. package/samples/TextBox/RenderCenter.vue +1 -1
  126. package/samples/TextBox/RenderLeft.vue +1 -1
  127. package/samples/TextBox/RenderOneLine.vue +1 -1
  128. package/samples/TextBox/RenderRight.vue +1 -1
  129. package/samples/TextShadowDemo/App.vue +1 -2
  130. package/samples/TextureAnimation/App.vue +16 -13
  131. package/samples/TextureAnimation/App2.vue +111 -0
  132. package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  133. package/samples/TextureAnimation/assets/light.png +0 -0
  134. package/samples/TextureAnimation/assets/light2.png +0 -0
  135. package/samples/TextureAnimation/assets/mask.png +0 -0
  136. package/samples/TextureSize/App.vue +15 -25
  137. package/samples/ThrowMoveDemo/AccelerateDemo.vue +2 -4
  138. package/samples/ThrowMoveDemo/LRParabolicDemo.vue +2 -3
  139. package/samples/ThrowMoveDemo/TargetDemo.vue +3 -4
  140. package/samples/ThrowMoveDemo/UDParabolicDemo.vue +2 -3
  141. package/samples/TouchSample/App.vue +2 -3
  142. package/samples/TouchSample/Item.vue +15 -13
  143. package/samples/TouchSample/MetroWidgetHorizontal.vue +2 -2
  144. package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
  145. package/samples/TouchSample/TouchContainerHorizontal.vue +4 -3
  146. package/samples/TouchSample/TouchContainerVertical.vue +3 -2
  147. package/samples/TransitPage/App.vue +20 -32
  148. package/samples/VideoDemo/App.vue +65 -81
  149. package/samples/VideoDemo/components/Button.vue +41 -52
  150. package/samples/VideoDemo/components/Controllor.vue +171 -169
  151. package/samples/VideoDemo/components/VideoFrame.vue +87 -99
  152. package/samples/VisibleSensorDemo/App.vue +234 -0
  153. package/scripts/jsview-jsmap-serve.js +42 -0
  154. package/scripts/jsview-post-install.js +1 -1
  155. package/tsconfig.json +3 -0
  156. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +204 -193
  157. package/utils/JsViewEngineWidget/JsvFocusManager.js +30 -17
  158. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1561 -1656
  159. package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
  160. package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
  161. package/utils/JsViewEngineWidget/TemplateParser.js +111 -1
  162. package/utils/JsViewEngineWidget/WidgetCommon.js +8 -2
  163. package/utils/JsViewEngineWidget/index.js +4 -4
  164. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
  165. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +301 -58
  166. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +22 -3
  167. package/utils/JsViewPlugin/JsvPlayer/index.js +8 -1
  168. package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
  169. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  170. package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
  171. package/utils/JsViewVueTools/index.js +20 -0
  172. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  173. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
  174. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
  175. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
  176. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
  177. package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
  178. package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
  179. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
  180. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
  181. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -1
  182. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +8 -17
  183. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
  184. package/utils/JsViewVueWidget/JsvPosterDiv.vue +37 -7
  185. package/utils/JsViewVueWidget/JsvPosterImage.vue +34 -13
  186. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +39 -53
  187. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  188. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
  189. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
  190. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
  191. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +6 -1
  192. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +6 -1
  193. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +142 -61
  194. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
  195. package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
  196. package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
  197. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +141 -0
  198. package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +9 -0
  199. package/utils/JsViewVueWidget/index.js +42 -0
  200. package/samples/AdvanceMetroWidget/App.vue +0 -123
  201. package/samples/AdvanceMetroWidget/Frame.vue +0 -102
  202. package/samples/AdvanceMetroWidget/Item.vue +0 -63
  203. package/samples/AdvanceMetroWidget/data.js +0 -137
  204. package/samples/ClassNameDemo/App.vue +0 -119
  205. package/samples/ClassNameDemo/components/ContentItem.vue +0 -253
  206. package/samples/ClassNameDemo/components/LoadingView.vue +0 -43
  207. package/samples/ClassNameDemo/components/TitleView.vue +0 -24
  208. package/samples/ClassNameDemo/data.js +0 -24
  209. package/samples/FlowMultiWidget/App.vue +0 -91
  210. package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
  211. package/samples/FlowMultiWidget/components/Block.vue +0 -107
  212. package/samples/FlowMultiWidget/components/FlowPage.vue +0 -60
  213. package/samples/FlowMultiWidget/components/Item.vue +0 -103
  214. package/samples/FlowMultiWidget/components/MenuItem.vue +0 -72
  215. package/samples/FlowMultiWidget/components/MyMenu.vue +0 -90
  216. package/samples/FlowMultiWidget/data.js +0 -446
  217. package/samples/HashHistory/views/BasePage.vue +0 -19
  218. package/samples/HashHistory/views/SubPageFirst.vue +0 -10
  219. package/samples/HashHistory/views/SubPageSecond.vue +0 -10
  220. package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
  221. package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
  222. package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
  223. package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
  224. package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
  225. package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
  226. package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
  227. package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
  228. package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
  229. package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
  230. package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
  231. package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
  232. package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
  233. package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
  234. package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
  235. package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
  236. package/samples/SimpleWidgetDemo/data.js +0 -124
  237. package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +0 -63
  238. package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +0 -51
  239. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +0 -213
  240. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +0 -154
@@ -1,121 +1,109 @@
1
- <script>
2
- import { inject, watch } from 'vue'
3
- import { Options, Vue } from "vue-class-component";
4
- import JsvVideo from "jsview/utils/JsViewVueWidget/JsvVideo.vue"
5
-
6
- @Options({
7
- components: {
8
- JsvVideo
1
+ <script setup>
2
+ import { inject, watch, onMounted } from "vue";
3
+ import { JsvVideo } from "jsview";
4
+
5
+ const useTexture = inject("useTexture");
6
+ const objectFit = inject("objectFit");
7
+ const videoRect = inject("videoRect");
8
+ const playVideo = inject("playVideo");
9
+ const seekVideo = inject("seekVideo");
10
+ const enableAnimation = inject("enableAnimation");
11
+ const videoTime = inject("videoTime");
12
+ const playStatus = inject("playStatus");
13
+ const videoUrl =
14
+ "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
15
+ const canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
16
+ const rect = {
17
+ top: 50,
18
+ left: 40,
19
+ width: 1200,
20
+ height: 500,
21
+ };
22
+ let video = null;
23
+
24
+ const onVideoRef = (ele) => {
25
+ video = ele;
26
+ };
27
+
28
+ const setPlayState = (play) => {
29
+ if (play) {
30
+ video?.play();
31
+ } else {
32
+ video?.pause();
9
33
  }
10
- })
11
-
12
- class VideoFrame extends Vue {
13
- constructor(props) {
14
- super(props);
15
- this.useTexture = inject('useTexture');
16
- this.objectFit = inject('objectFit');
17
- this.videoRect = inject('videoRect');
18
- this.playVideo = inject('playVideo');
19
- this.seekVideo = inject('seekVideo');
20
- this.enableAnimation = inject('enableAnimation');
21
- this.videoTime = inject('videoTime');
22
- this.playStatus = inject('playStatus')
23
- watch(this.playVideo, this.setPlayState.bind(this));
24
- watch(this.seekVideo, this.seekVideoStep.bind(this));
25
-
26
- this.videoUrl = "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
27
- this.canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
28
-
29
- this.video = null;
30
-
31
- this.rect = {
32
- top: 50, left: 40,
33
- width: 1200, height: 500,
34
+ };
35
+
36
+ const seekVideoStep = (time) => {
37
+ if (video) {
38
+ let playEnd = false;
39
+ let seekTime = video.currentTime + Math.ceil(time);
40
+ if (seekTime < 0) {
41
+ seekTime = 0;
42
+ } else if (seekTime > videoTime.duration) {
43
+ seekTime = videoTime.duration;
44
+ if (video.currentTime != videoTime.duration) {
45
+ // 触发一次播放,收到ended事件
46
+ playEnd = true;
47
+ }
34
48
  }
35
-
36
- this.textureAnim = null;
37
- }
38
-
39
- mounted() {
40
- if(this.canAutoPlay) {
41
- this.playVideo = true;
49
+ video.currentTime = seekTime;
50
+ if (playEnd) {
51
+ this.setPlayState(true);
42
52
  }
43
53
  }
44
-
45
- onVideoRef(ele) {
46
- this.video = ele;
54
+ };
55
+
56
+ const onPlayStateChange = (event) => {
57
+ console.log("VideoFrame.onPlayStateChangeEvent()", event);
58
+ playVideo.value = event.type === "play" ? true : false;
59
+ if (!(playStatus.value == "ended" && event.type == "pause")) {
60
+ // 忽略播放结束后的pause事件
61
+ playStatus.value = event.type;
47
62
  }
63
+ };
48
64
 
49
- setPlayState(play) {
50
- if(play) {
51
- this.video?.play();
52
- } else {
53
- this.video?.pause();
54
- }
55
- }
65
+ const onTimeUpdate = (event) => {
66
+ console.log("VideoFrame.onTimeUpdateEvent()", event);
67
+ videoTime.currentTime = video.currentTime;
68
+ };
56
69
 
57
- seekVideoStep(time) {
58
- if(this.video) {
59
- let playEnd = false;
60
- let seekTime = this.video.currentTime + Math.ceil(time);
61
- if(seekTime < 0) {
62
- seekTime = 0;
63
- } else if(seekTime > this.videoTime.duration) {
64
- seekTime = this.videoTime.duration;
65
- if(this.video.currentTime != this.videoTime.duration) { // 触发一次播放,收到ended事件
66
- playEnd = true;
67
- }
68
- }
69
- this.video.currentTime = seekTime;
70
- if(playEnd) {
71
- this.setPlayState(true);
72
- }
73
- }
74
- }
70
+ const onDurationChange = (event) => {
71
+ console.log("VideoFrame.onDurationChangeEvent()", event);
72
+ videoTime.duration = video.duration;
73
+ };
75
74
 
76
- onPlayStateChange(event) {
77
- console.log("VideoFrame.onPlayStateChangeEvent()", event);
78
- this.playVideo = (event.type === 'play' ? true : false);
79
- if(!(this.playStatus == 'ended' && event.type == 'pause')) { // 忽略播放结束后的pause事件
80
- this.playStatus = event.type;
81
- }
82
- }
75
+ const onEvent = (event) => {
76
+ console.log("VideoFrame.onEvent()", event);
77
+ };
83
78
 
84
- onTimeUpdate(event) {
85
- console.log("VideoFrame.onTimeUpdateEvent()", event);
86
- this.videoTime.currentTime = this.video.currentTime;
87
- }
88
-
89
- onDurationChange(event) {
90
- console.log("VideoFrame.onDurationChangeEvent()", event);
91
- this.videoTime.duration = this.video.duration;
92
- }
79
+ watch(playVideo, setPlayState);
80
+ watch(seekVideo, seekVideoStep);
93
81
 
94
- onEvent(event) {
95
- console.log("VideoFrame.onEvent()", event);
82
+ onMounted(() => {
83
+ if (canAutoPlay) {
84
+ playVideo.value = true;
96
85
  }
97
- }
98
-
99
- export default VideoFrame;
86
+ });
100
87
  </script>
101
88
 
102
89
  <template>
103
- <div>
104
- <div
90
+ <div>
91
+ <div
105
92
  :style="{
106
93
  ...videoRect,
107
- backgroundColor: 'rgb(200,100,100)'
94
+ backgroundColor: 'rgb(200,100,100)',
108
95
  }"
109
- />
110
- <JsvVideo
96
+ ></div>
97
+ <JsvVideo
111
98
  :onRef="onVideoRef"
112
99
  :useTexture="useTexture"
113
100
  :src="videoUrl"
114
- :autoplay="canAutoPlay ? 'autoplay' : undefined"
101
+ :autoplay="canAutoPlay ? 'autoplay' : undefined"
115
102
  :style="{
116
103
  ...videoRect,
117
104
  objectFit: objectFit,
118
- animation: (useTexture&&enableAnimation ? 'offscreenAnim 3s infinite' : null),
105
+ animation:
106
+ useTexture && enableAnimation ? 'offscreenAnim 3s infinite' : null,
119
107
  borderRadius: '80px 80px 160px 240px',
120
108
  }"
121
109
  :onCanPlay="onEvent"
@@ -134,18 +122,18 @@ export default VideoFrame;
134
122
  :onSeeked="onTimeUpdate"
135
123
  :onStalled="onEvent"
136
124
  :onTimeUpdate="onTimeUpdate"
137
- />
138
- </div>
125
+ />
126
+ </div>
139
127
  </template>
140
128
 
141
129
  <style scoped>
142
130
  @keyframes offscreenAnim {
143
131
  from {
144
- transform:scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
132
+ transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
145
133
  transform-origin: center center;
146
134
  }
147
135
  to {
148
- transform:scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
136
+ transform: scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
149
137
  transform-origin: center center;
150
138
  }
151
139
  }
@@ -0,0 +1,234 @@
1
+ <script setup>
2
+ import { watch, reactive, onMounted, ref } from "vue";
3
+ import { useRouter } from "vue-router";
4
+ import { jJsvRuntimeBridge, JsvVisibleSensor } from "jsview";
5
+
6
+ const BOX_WIDTH = 150;
7
+ const BOX_HEIGHT = 150;
8
+ const BOX_COLOR = "rgba(0,255,255,0.6)";
9
+ const VISIBLE_RANGE = 0.25;
10
+
11
+ const router = useRouter();
12
+
13
+ const containerRef = ref(null);
14
+ let case_config = ref(null);
15
+ let status_text = reactive({
16
+ oldH: "false",
17
+ newH: "false",
18
+ oldV: "false",
19
+ newV: "false",
20
+ });
21
+
22
+ let test_case_type = ref(0);
23
+
24
+ window.LudlTestCase = test_case_type;
25
+
26
+ case_config.value = getTestCase(test_case_type.value);
27
+
28
+ watch(test_case_type, () => {
29
+ case_config.value = getTestCase(test_case_type.value);
30
+ });
31
+
32
+ onMounted(() => {
33
+ jJsvRuntimeBridge.notifyPageLoaded();
34
+ });
35
+
36
+ // const onAnimDone = () => {
37
+ // test_case_type.value = (test_case_type.value + 1) % 2;
38
+ // };
39
+
40
+ // 内部接口
41
+ const onBeVisible = (old_h, new_h, old_v, new_v) => {
42
+ status_text.oldH = old_h ? "true" : "false";
43
+ status_text.newH = new_h ? "true" : "false";
44
+ status_text.oldV = old_v ? "true" : "false";
45
+ status_text.newV = new_v ? "true" : "false";
46
+ };
47
+
48
+ const onKeyDown = (ev) => {
49
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
50
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
51
+ router?.go(-1); // 有router时,回退
52
+ return true;
53
+ }
54
+ if (ev.keyCode == 13) {
55
+ test_case_type.value = (test_case_type.value + 1) % 2;
56
+ }
57
+ return false;
58
+ };
59
+
60
+ function getTestCase(test_index) {
61
+ let test_config = {
62
+ animation: null,
63
+ text: null,
64
+ horizon: 1.0,
65
+ vertical: 1.0,
66
+ };
67
+
68
+ switch (test_index) {
69
+ case 0: {
70
+ // 上到下
71
+ test_config.animation = "visibleSensor_upDown 8s infinite linear";
72
+ test_config.text = "从上到下";
73
+ test_config.horizon = 1.0;
74
+ test_config.vertical = VISIBLE_RANGE;
75
+ break;
76
+ }
77
+ case 1: {
78
+ // 左到右
79
+ test_config.animation = "visibleSensor_leftRight 8s infinite linear";
80
+ test_config.text = "从左到右";
81
+ test_config.horizon = VISIBLE_RANGE;
82
+ test_config.vertical = 1.0;
83
+ break;
84
+ }
85
+ }
86
+
87
+ return test_config;
88
+ }
89
+ </script>
90
+
91
+ <template>
92
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
93
+ <div :style="{ width: 1280, height: 720, backgroundColor: '#00F000' }">
94
+ <div
95
+ :style="{
96
+ left: 10,
97
+ top: 10,
98
+ height: 120,
99
+ width: 900,
100
+ fontColor: '#000000',
101
+ fontSize: 15,
102
+ lineHeight: 20,
103
+ }"
104
+ >
105
+ {{
106
+ `按OK键切换方向
107
+ new horizon: ${status_text.newH}
108
+ new vertical: ${status_text.newV}
109
+ -------
110
+ old horizon: ${status_text.oldH}
111
+ old vertical: ${status_text.oldV}`
112
+ }}
113
+ </div>
114
+ <div
115
+ ref="containerRef"
116
+ :style="{
117
+ left: 240,
118
+ top: 180,
119
+ width: 300,
120
+ height: 300,
121
+ backgroundColor: '#00F0F0',
122
+ }"
123
+ >
124
+ <div
125
+ :style="{
126
+ left: 50,
127
+ top: 50,
128
+ width: 200,
129
+ height: 200,
130
+ backgroundColor: '#00AAAA',
131
+ zIndex: test_case_type == 0 ? -22 : 0,
132
+ }"
133
+ />
134
+
135
+ <div
136
+ :style="{
137
+ left: 80,
138
+ top: 30,
139
+ width: 140,
140
+ height: 240,
141
+ backgroundColor: '#0000AA',
142
+ zIndex: test_case_type == 0 ? -33 : 0,
143
+ }"
144
+ />
145
+
146
+ <div
147
+ :style="{
148
+ left: 0,
149
+ top: 0,
150
+ animation: case_config.animation,
151
+ }"
152
+ >
153
+ <JsvVisibleSensor
154
+ :horizonShown="case_config.horizon"
155
+ :verticalShown="case_config.vertical"
156
+ :width="BOX_WIDTH"
157
+ :height="BOX_HEIGHT"
158
+ :enable="true"
159
+ :container="containerRef"
160
+ :callback="onBeVisible"
161
+ >
162
+ <div v-if="test_case_type == 0">
163
+ <div
164
+ :style="{
165
+ width: BOX_WIDTH,
166
+ height: BOX_HEIGHT * VISIBLE_RANGE,
167
+ backgroundColor: '#FF0000',
168
+ }"
169
+ />
170
+ <div
171
+ :style="{
172
+ top: BOX_HEIGHT * (1 - VISIBLE_RANGE),
173
+ width: BOX_WIDTH,
174
+ height: BOX_HEIGHT * VISIBLE_RANGE,
175
+ backgroundColor: '#FF0000',
176
+ }"
177
+ />
178
+ </div>
179
+ <div v-else>
180
+ <div
181
+ :style="{
182
+ width: BOX_WIDTH * VISIBLE_RANGE,
183
+ height: BOX_HEIGHT,
184
+ backgroundColor: '#FF0000',
185
+ }"
186
+ />
187
+ <div
188
+ :style="{
189
+ left: BOX_WIDTH * (1 - VISIBLE_RANGE),
190
+ width: BOX_WIDTH * VISIBLE_RANGE,
191
+ height: BOX_HEIGHT,
192
+ backgroundColor: '#FF0000',
193
+ }"
194
+ />
195
+ </div>
196
+ <div
197
+ :style="{
198
+ width: BOX_WIDTH,
199
+ height: BOX_HEIGHT,
200
+ backgroundColor: BOX_COLOR,
201
+ fontSize: 20,
202
+ lineHeight: 30,
203
+ }"
204
+ >
205
+ {{
206
+ `${case_config.text}\nH:${status_text.newH}\nV:${status_text.newV}`
207
+ }}
208
+ </div>
209
+ </JsvVisibleSensor>
210
+ </div>
211
+ </div>
212
+ </div>
213
+ </jsv-focus-block>
214
+ </template>
215
+
216
+ <style scoped>
217
+ @keyframes visibleSensor_upDown {
218
+ from {
219
+ transform: translate3d(75px, -180px, 0);
220
+ }
221
+ to {
222
+ transform: translate3d(75px, 330px, 0);
223
+ }
224
+ }
225
+
226
+ @keyframes visibleSensor_leftRight {
227
+ from {
228
+ transform: translate3d(-180px, 75px, 0);
229
+ }
230
+ to {
231
+ transform: translate3d(330px, 75px, 0);
232
+ }
233
+ }
234
+ </style>
@@ -6,10 +6,37 @@ const os = require('os');
6
6
 
7
7
  let baseDir = __dirname;
8
8
 
9
+ let script_name = __filename.substr(__dirname.length + 1)
10
+
11
+ let redirect_url;
12
+ if (process.argv.length >= 2) {
13
+ let args_start = 0;
14
+ for (let i = 0; i < process.argv.length; i++) {
15
+ if (process.argv[i].endsWith(script_name)) {
16
+ args_start = i + 1;
17
+ break;
18
+ }
19
+ }
20
+ const args = process.argv.slice(args_start)
21
+ redirect_url = args[0]
22
+ if (!redirect_url.endsWith('/')) {
23
+ redirect_url = redirect_url + '/';
24
+ }
25
+ }
26
+
9
27
  function requestListener(req, res) {
10
28
  console.log("[request] " + req.url);
11
29
 
12
30
  if (req.url.endsWith("\.map")) { // return map source file content
31
+ if (redirect_url) {
32
+ // redirect with 302 HTTP code in response
33
+ let redirect_target = redirect_url
34
+ + convertMapBaseUrl(req.url)
35
+ console.log(`redirect ${req.url} -> ${redirect_target}`)
36
+ res.writeHead(302, { "Location": redirect_target });
37
+ return res.end();
38
+ }
39
+
13
40
  try {
14
41
  const fileContent = fs.readFileSync(baseDir + '/' + req.url);
15
42
 
@@ -26,6 +53,18 @@ function requestListener(req, res) {
26
53
  res.end();
27
54
  };
28
55
 
56
+ function convertMapBaseUrl(origin_url) {
57
+ if (origin_url.startsWith('/map/')) {
58
+ /* 去掉子目录/map/ */
59
+ return origin_url.substr(5);
60
+ } else if (origin_url.startsWith('/')) {
61
+ /* 去掉'/' */
62
+ return origin_url.substring(1, origin_url.length);
63
+ } else {
64
+ return origin_url;
65
+ }
66
+ }
67
+
29
68
  function getIPAddress() {
30
69
  let ret = [];
31
70
 
@@ -52,6 +91,9 @@ function main() {
52
91
  server.listen(port, '0.0.0.0', () => {
53
92
  console.log('');
54
93
  console.log('JavaScript source map running at:');
94
+ if (redirect_url) {
95
+ console.log('with redirect url=' + redirect_url)
96
+ }
55
97
  console.log(' - Local: localhost:' + port);
56
98
  getIPAddress().forEach(ip => {
57
99
  console.log(' - Network: ' + ip + ':' + port);
@@ -53,7 +53,7 @@ async function printRevision(options) {
53
53
 
54
54
  console.log('**************************************************');
55
55
  console.log('* Update revision to:');
56
- console.log('* CORE: ' + jsviewTargetVersion.CoreRevision);
56
+ console.log('* CORE: ' + jsviewTargetVersion.CoreRevisionAndBranch);
57
57
  console.log('* ENGINE JS URL: ' + jsviewTargetVersion.JseUrl);
58
58
  console.log('* PLUGIN LIST: ');
59
59
 
package/tsconfig.json CHANGED
@@ -22,6 +22,9 @@
22
22
  ],
23
23
  "jsview/*": [
24
24
  "./*"
25
+ ],
26
+ "jsview": [
27
+ "./index.js"
25
28
  ]
26
29
  },
27
30
  "lib": [