@shijiu/jsview-vue 1.9.650 → 1.9.720

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 (157) hide show
  1. package/package.json +7 -18
  2. package/samples/AnimPicture/App.vue +5 -5
  3. package/samples/Basic/components/div/DivLayout.vue +1 -1
  4. package/samples/Basic/components/text/TextOverflow.vue +10 -5
  5. package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
  6. package/samples/Collision/App.vue +452 -0
  7. package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
  8. package/samples/DemoHomepage/router.js +21 -1
  9. package/samples/DemoHomepage/views/Homepage.vue +3 -7
  10. package/samples/FilterDemo/App.vue +1 -1
  11. package/samples/FlipCard/App.vue +2 -2
  12. package/samples/FlipCard/FlipCard.vue +2 -2
  13. package/samples/GridDemo/App.vue +3 -3
  14. package/samples/GridDemo/ButtonBlock.vue +2 -2
  15. package/samples/GridDemo/FocusItem.vue +2 -2
  16. package/samples/GridDemo/Item.vue +1 -1
  17. package/samples/HashHistory/App.vue +10 -3
  18. package/samples/HashHistory/components/Item.vue +1 -1
  19. package/samples/ImpactStop/App.vue +435 -0
  20. package/samples/Input/App.vue +8 -17
  21. package/samples/Input/InputPanel.vue +19 -12
  22. package/samples/LongImage/Button.vue +1 -1
  23. package/samples/LongImage/ButtonItem.vue +1 -1
  24. package/samples/LongImage/LongImageScroll.vue +2 -2
  25. package/samples/LongText/App.vue +1 -1
  26. package/samples/LongText/Button.vue +1 -1
  27. package/samples/LongText/ButtonItem.vue +1 -1
  28. package/samples/LongText/LongTextScroll.vue +3 -3
  29. package/samples/Marquee/App.vue +176 -40
  30. package/samples/Marquee/longText.js +14 -0
  31. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  32. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +3 -3
  33. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  34. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  35. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  36. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  37. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  38. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  39. package/samples/MetroWidgetDemos/Item.vue +20 -2
  40. package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
  41. package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
  42. package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +1 -1
  43. package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
  44. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
  45. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
  46. package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +3 -11
  47. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
  48. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  49. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  50. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
  51. package/samples/MetroWidgetDemos/WidgetItem.vue +2 -2
  52. package/samples/MetroWidgetDemos/data.js +2 -1
  53. package/samples/NinePatchDemo/App.vue +2 -2
  54. package/samples/NinePatchDemo/Item.vue +1 -1
  55. package/samples/Preload/App.vue +17 -12
  56. package/samples/Preload/Item.vue +1 -1
  57. package/samples/QrcodeDemo/App.vue +1 -1
  58. package/samples/ScaleDownNeon/App.vue +107 -0
  59. package/samples/SoundPool/App.vue +1 -1
  60. package/samples/TextBox/App.vue +9 -82
  61. package/samples/TextBox/RenderCenter.vue +40 -16
  62. package/samples/TextBox/RenderLeft.vue +48 -19
  63. package/samples/TextBox/RenderOneLine.vue +30 -49
  64. package/samples/TextBox/RenderRight.vue +40 -16
  65. package/samples/TextShadowDemo/App.vue +11 -17
  66. package/samples/TextureAnimation/App2.vue +43 -15
  67. package/samples/TextureAnimation/assets/light.png +0 -0
  68. package/samples/TextureAnimation/assets/light2.png +0 -0
  69. package/samples/TextureSize/App.vue +3 -3
  70. package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
  71. package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
  72. package/samples/TransitPage/App.vue +1 -1
  73. package/samples/VideoDemo/App.vue +8 -8
  74. package/samples/VideoDemo/components/Button.vue +1 -1
  75. package/samples/VisibleSensorDemo/App.vue +94 -27
  76. package/tsconfig.json +6 -6
  77. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +55 -59
  78. package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
  79. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  80. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +226 -107
  81. package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
  82. package/utils/JsViewEngineWidget/WidgetCommon.js +13 -5
  83. package/utils/JsViewEngineWidget/index.js +3 -2
  84. package/utils/JsViewPlugin/BrowserPluginLoader.js +1 -1
  85. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
  86. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +23 -2
  87. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +1 -1
  88. package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
  89. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  90. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  91. package/utils/JsViewVueTools/JsvStyleClass.js +1 -1
  92. package/utils/JsViewVueTools/index.js +2 -1
  93. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  94. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
  95. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +7 -9
  96. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
  97. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +3 -3
  98. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
  99. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +5 -5
  100. package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
  101. package/utils/JsViewVueWidget/JsvGrid.vue +3 -11
  102. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +5 -3
  103. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +15 -14
  104. package/utils/JsViewVueWidget/JsvMarquee.vue +180 -207
  105. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -2
  106. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  107. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  108. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +38 -42
  109. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  110. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  111. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +24 -8
  112. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
  113. package/utils/JsViewVueWidget/JsvTextBox.vue +20 -86
  114. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -9
  115. package/utils/JsViewVueWidget/JsvTouchContainer.vue +6 -7
  116. package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
  117. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +6 -6
  118. package/utils/JsViewVueWidget/index.js +8 -8
  119. package/utils/JsViewVueWidget/utils/index.js +8 -0
  120. package/utils/JsViewVueWidget/utils/text.js +19 -0
  121. package/dom/bin/jsview-browser-debug-dom.min.js +0 -1
  122. package/dom/bin/jsview-dom.min.js +0 -1
  123. package/dom/bin/jsview-forge-define.min.js +0 -1
  124. package/dom/browser-root-style.css +0 -21
  125. package/dom/jsv-browser-debug-dom.js +0 -8
  126. package/dom/jsv-dom.js +0 -6
  127. package/dom/jsv-forge-define.js +0 -6
  128. package/dom/target_core_revision.mjs +0 -15
  129. package/loader/header_script_loader.js +0 -134
  130. package/loader/jsview-main.js +0 -42
  131. package/loader/jsview.config.default.js +0 -37
  132. package/loader/jsview.default.config.js +0 -37
  133. package/loader/loader.js +0 -179
  134. package/loader/loader_webkit.js +0 -40
  135. package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17609
  136. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -335
  137. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +0 -446
  138. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +0 -91
  139. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8038
  140. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1700
  141. package/patches/node_modules/postcss-js/objectifier.js +0 -90
  142. package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +0 -63147
  143. package/patches/node_modules/vite/dist/node/jsview.vite.config.js +0 -53
  144. package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3595
  145. package/scripts/common.js +0 -58
  146. package/scripts/jsview-install-local-packages.js +0 -73
  147. package/scripts/jsview-jsmap-serve.js +0 -105
  148. package/scripts/jsview-post-build.js +0 -183
  149. package/scripts/jsview-post-install.js +0 -102
  150. package/scripts/jsview-run-android.js +0 -67
  151. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  152. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  153. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  154. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  155. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  156. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  157. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -20,7 +20,7 @@
20
20
  * play(): 开始播放
21
21
  -->
22
22
  <script>
23
- import { ForgeExtension } from "../../../dom/jsv-forge-define";
23
+ import { ForgeExtension } from "../../../../jsview/dom/jsv-forge-define";
24
24
 
25
25
  let LOOP_DEFAULT = 0;
26
26
  let LOOP_INFINITE = 1;
@@ -68,7 +68,7 @@ export default {
68
68
  methods: {
69
69
  play() {
70
70
  if (this.$refs.element) {
71
- let main_view = this.$refs.element.jsvMainView;
71
+ let main_view = this.$refs.element.jsvGetProxyView();
72
72
  if (main_view && main_view.ChildViews.length > 0) {
73
73
  let target_view = main_view.ChildViews[0];
74
74
  if (
@@ -106,7 +106,7 @@ export default {
106
106
  },
107
107
  stop() {
108
108
  if (this.$refs.element) {
109
- let main_view = this.$refs.element.jsvMainView;
109
+ let main_view = this.$refs.element.jsvGetProxyView();
110
110
  if (main_view && main_view.ChildViews.length > 0) {
111
111
  let target_view = main_view.ChildViews[0];
112
112
  if (
@@ -130,7 +130,7 @@ export default {
130
130
  }
131
131
  if (this.onLoad) {
132
132
  if (this.$refs.element) {
133
- let main_view = this.$refs.element.jsvMainView;
133
+ let main_view = this.$refs.element.jsvGetProxyView();
134
134
  if (main_view && main_view.ChildViews.length > 0) {
135
135
  let target_view = main_view.ChildViews[0];
136
136
  if (
@@ -151,7 +151,7 @@ export default {
151
151
  beforeUnmount() {
152
152
  this.stop();
153
153
  if (this.$refs.element) {
154
- let main_view = this.$refs.element.jsvMainView;
154
+ let main_view = this.$refs.element.jsvGetProxyView();
155
155
  if (main_view && main_view.ChildViews.length > 0) {
156
156
  let target_view = main_view.ChildViews[0];
157
157
  if (
@@ -11,7 +11,7 @@
11
11
  * "gray-down": 黑白滤镜(公祭日滤镜)
12
12
  -->
13
13
  <script setup>
14
- import { Forge, ForgeExtension } from "../../dom/jsv-forge-define";
14
+ import { Forge, ForgeExtension } from "../../../jsview/dom/jsv-forge-define";
15
15
  import { onBeforeUnmount, watchEffect } from "vue";
16
16
 
17
17
  const props = defineProps({
@@ -66,7 +66,7 @@
66
66
  -->
67
67
  <script>
68
68
  import { reactive } from "vue";
69
- import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
69
+ import { EdgeDirection, FocusMoveType } from "../JsViewEngineWidget";
70
70
 
71
71
  const TAG = "JsvGrid";
72
72
 
@@ -93,15 +93,7 @@ class LineType extends UpdateType {
93
93
  }
94
94
  }
95
95
 
96
- const FocusMoveType = {
97
- NO_ADJUST: 0x00000000,
98
- COLUMN_LOOP: 0x00000001,
99
- ROW_LOOP: 0x00000001 << 1,
100
- COLUMN_FIND_NEAR: 0x00000001 << 2,
101
- ROW_FIND_NEAR: 0x00000001 << 3,
102
- };
103
-
104
- export { PageType, LineType, FocusMoveType };
96
+ export { PageType, LineType };
105
97
 
106
98
  export default {
107
99
  props: {
@@ -668,4 +660,4 @@ export default {
668
660
  ></slot>
669
661
  </div>
670
662
  </jsv-focus-block>
671
- </template>
663
+ </template>
@@ -2,11 +2,11 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-01-20 10:37:01
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-01-20 17:07:17
5
+ * @LastEditTime: 2022-09-02 13:28:59
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
- import { ref } from "vue";
9
+ import { ref, shallowRef } from "vue";
10
10
  export default {
11
11
  props: {
12
12
  left: Number,
@@ -39,7 +39,9 @@ export default {
39
39
  this.visible = show;
40
40
  },
41
41
  },
42
- mounted() {},
42
+ mounted() {
43
+ this.startBlink();
44
+ },
43
45
  beforeUnmount() {
44
46
  this._cleanInterval();
45
47
  },
@@ -2,12 +2,12 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-01-20 10:35:56
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-02-21 10:17:42
5
+ * @LastEditTime: 2022-09-02 13:44:56
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
- import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
10
- import { Forge, ForgeExtension } from "../../../dom/jsv-forge-define";
9
+ import { EdgeDirection } from "../../JsViewEngineWidget";
10
+ import { Forge, ForgeExtension } from "../../../../jsview/dom/jsv-forge-define";
11
11
  import CursorVue from "./Cursor.vue";
12
12
 
13
13
  const InputType = {
@@ -228,9 +228,9 @@ export default {
228
228
  !ifDigital(add_text) &&
229
229
  this.type === InputType.NUMBER
230
230
  ) {
231
- console.log(
232
- `onTextChanged add text failed, add_text:${add_text}, when input type is number!`
233
- );
231
+ // console.log(
232
+ // `onTextChanged add text failed, add_text:${add_text}, when input type is number!`
233
+ // );
234
234
  if (this.editControlView) {
235
235
  this.editControlView.updateCursorOffset(
236
236
  this.fullString,
@@ -255,7 +255,7 @@ export default {
255
255
 
256
256
  // 1:shown 0:hidden
257
257
  _onStatusChanged(status) {
258
- console.log("OnStatusChanged status", status);
258
+ // console.log("OnStatusChanged status", status);
259
259
  },
260
260
 
261
261
  _getStringWithFont(str) {
@@ -327,7 +327,7 @@ export default {
327
327
 
328
328
  add(string) {
329
329
  if (this.type === InputType.NUMBER && !ifDigital(string)) {
330
- console.log(`The input data:${string} is not number`);
330
+ // console.log(`The input data:${string} is not number`);
331
331
  return;
332
332
  }
333
333
  const pre_full_str = this.fullString;
@@ -573,8 +573,9 @@ export default {
573
573
  },
574
574
 
575
575
  onFocus() {
576
- console.log("Input Focus");
576
+ // console.log("Input Focus");
577
577
  this.isFocus = true;
578
+ this.$refs.cursor?.startBlink();
578
579
  if (this.editControlView && !this.readonly) {
579
580
  this.editControlView.showIme(
580
581
  this.type,
@@ -586,7 +587,7 @@ export default {
586
587
 
587
588
  onBlur() {
588
589
  this.isFocus = false;
589
- console.log("Input Blur");
590
+ // console.log("Input Blur");
590
591
  if (this.editControlView && !this.readonly) {
591
592
  this.editControlView.hideIme();
592
593
  }
@@ -604,9 +605,7 @@ export default {
604
605
  }
605
606
  this.clearCursorPauseTimer();
606
607
  this.cursorPauseTimeoutToken = setTimeout(() => {
607
- if (this.$refs.cursor) {
608
- this.$refs.cursor?.startBlink();
609
- }
608
+ this.$refs.cursor?.startBlink();
610
609
  }, 500);
611
610
  },
612
611
  onKeyDown(keyEvent) {
@@ -731,7 +730,9 @@ export default {
731
730
  this.textWidth = cur_position > this.width ? cur_position : this.width;
732
731
  this.textLeft = this._calculateSlide("", this.value, this.value.length);
733
732
  },
734
- mounted() {},
733
+ mounted() {
734
+ this.$refs.cursor?.startBlink();
735
+ },
735
736
  beforeUnmount() {
736
737
  if (this.editControlViewId != -1) {
737
738
  const view_store = ForgeExtension.RootActivity
@@ -3,239 +3,212 @@
3
3
  * JsvMarquee:Vue高阶组件,文字跑马灯
4
4
  * props说明:
5
5
  * text {String} 文字内容
6
- * layoutStyles {Array|Object} 控件位置信息 [{top: 0, left: 0, width: 0, height: 0}]
7
- * fontStyles {Array|Object} 文字样式
6
+ * style {Object} 样式
8
7
  * slideSpeed {int} 滚动速度 px/s, 默认60
9
8
  * forceSlide {boolean} 短文字是否滚动,默认false
10
9
  -->
11
10
 
12
- <script>
13
- import { Forge } from "../../dom/jsv-forge-define";
14
- import {
15
- JsvStyleClass,
16
- JsvTextStyleClass,
17
- combinedStyles,
18
- } from "../JsViewVueTools/JsvStyleClass";
11
+ <script setup>
12
+ import { Forge } from "../../../jsview/dom/jsv-forge-define";
13
+ import { getTextWidth } from "./utils";
14
+ import { ref, shallowRef, computed, toRaw, onMounted, onBeforeUnmount } from "vue";
19
15
 
20
- const sDefaultLayoutStyle = new JsvStyleClass({
21
- left: 0,
22
- top: 0,
23
- width: 0,
24
- height: 20,
25
- });
26
- const sDefaultFontStyle = new JsvTextStyleClass({
27
- color: "rgba(255,255,255,1.0)",
28
- fontSize: 10,
29
- textAlign: "center",
30
- lineHeight: "20px",
31
- });
32
- const sCommonFontStyle = new JsvTextStyleClass({
33
- whiteSpace: "nowrap",
34
- });
35
- export default {
36
- props: {
37
- text: {
38
- type: String,
39
- default: "",
40
- },
41
- layoutStyles: {
42
- type: [Array, Object],
43
- default: () => [sDefaultLayoutStyle],
44
- },
45
- fontStyles: {
46
- type: [Array, Object],
47
- },
48
- styleToken: String,
49
- slideSpeed: {
50
- // 60px per second
51
- type: Number,
52
- default: 60,
53
- },
54
- forceSlide: {
55
- type: Boolean,
56
- default: false,
57
- },
58
- className: {
59
- type: String,
16
+ const defaultFontStyle = () => {
17
+ return {
18
+ color: "rgba(255,255,255,1.0)",
19
+ fontSize: 10,
20
+ textAlign: "start",
21
+ lineHeight: "20px",
22
+ whiteSpace: "nowrap",
23
+ direction: 'ltr'
24
+ };
25
+ };
26
+ const props = defineProps({
27
+ text: {
28
+ type: String,
29
+ default: "",
30
+ },
31
+ style: {
32
+ type: Object,
33
+ default() {
34
+ return {
35
+ left: 0,
36
+ top: 0,
37
+ width: 0,
38
+ height: 20,
39
+ color: "rgba(255,255,255,1.0)",
40
+ fontSize: 10,
41
+ textAlign: "start",
42
+ lineHeight: "20px",
43
+ whiteSpace: "nowrap",
44
+ direction: 'ltr,'
45
+ };
60
46
  },
61
47
  },
62
- data() {
63
- return {
64
- asyncTextLenTimer: -1,
65
- rollTimeId: -1,
66
- animationCount: 0,
67
- LayoutStyle: null,
68
- FontStyle: null,
69
- FontStyleClass: null,
70
- TokenProcessed: null,
71
- };
48
+ slideSpeed: {
49
+ type: Number,
50
+ default: 60,
72
51
  },
73
- setup() {},
74
- computed: {
75
- _className() {
76
- return this.FontStyleClass ? this.FontStyleClass : this.className;
77
- },
52
+ forceSlide: {
53
+ type: Boolean,
54
+ default: false,
78
55
  },
79
- methods: {
80
- _asyncStartSlider() {
81
- // 清理之前的Slider处理
82
- this._resetSlider();
56
+ });
57
+ const slideDiv = shallowRef(null);
58
+ const textDiv = shallowRef(null);
59
+ let animState = 0;
60
+ let animIdleHandler = -1;
61
+ let asyncStartHandler = -1;
62
+ const fontStyle = computed(() => {
63
+ let { left, top, width, height, ...rest } = props.style;
64
+ let r = defaultFontStyle();
65
+ Object.assign(r, rest);
66
+ if (props.forceSlide) {
67
+ //滚送时必需start对齐
68
+ r.textAlign = "start";
69
+ }
70
+ return r;
71
+ });
72
+ //rtl文字需要先获得文字宽度
73
+ let textWidth =
74
+ fontStyle.value.direction == "rtl" ? getTextWidth(props.text, fontStyle.value) : 0;
75
+ const slideDivLeft = computed(() =>
76
+ fontStyle.value.direction == "rtl" && props.style.width < textWidth
77
+ ? props.style.width - textWidth
78
+ : 0
79
+ );
83
80
 
84
- // 稍进行延迟,以等待JsView的native端描绘文字并回传文字宽度
85
- if (this.asyncTextLenTimer < 0) {
86
- this.asyncTextLenTimer = setTimeout(() => {
87
- if (
88
- this.forceSlide ||
89
- this.$refs.textRef.clientWidth > this.LayoutStyle.width
90
- ) {
91
- this._slideNextStep();
92
- }
93
- this.asyncTextLenTimer = -1;
94
- }, 500);
95
- }
96
- },
97
- _resetSlider() {
98
- if (this.rollTimeId >= 0) {
99
- clearTimeout(this.rollTimeId);
100
- this.rollTimeId = -1;
101
- }
102
- this.animationCount = 0;
103
- this.$refs.sliderRef?.jsvMaskView?.StopAnimation();
104
- },
105
- _slideNextStep() {
106
- const text_width = this.$refs.textRef.clientWidth;
107
- if (this.animationCount % 2 === 0) {
108
- // 文字从原始位置,向左移动出屏幕(每次完整移动,停顿1秒)
109
- this.rollTimeId = setTimeout(() => {
110
- this.rollTimeId = -1;
111
- const anim = new Forge.TranslateFrameAnimation(
112
- 0,
113
- -text_width,
114
- this.$props.slideSpeed,
115
- true,
116
- 0,
117
- 0
118
- );
119
- anim.SetAnimationListener(
120
- new Forge.AnimationListener(
121
- null,
122
- (ended) => {
123
- if (ended) {
124
- // 正常结束,非Cancel时,进行下一个动作
125
- this._slideNextStep();
126
- }
127
- },
128
- null
129
- )
130
- );
131
- anim.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
132
- this.$refs.sliderRef.jsvMaskView.StartAnimation(anim);
133
- this.animationCount += 1;
134
- }, 1000);
135
- } else {
136
- // 文字从右边屏幕外部,移动回屏幕中的文字原始位置
137
- const anim = new Forge.TranslateFrameAnimation(
138
- this.LayoutStyle.width,
139
- 0,
140
- this.$props.slideSpeed,
141
- true,
142
- this.LayoutStyle.width,
143
- 0
144
- );
145
- anim.SetAnimationListener(
146
- new Forge.AnimationListener(
147
- null,
148
- (ended) => {
149
- if (ended) {
150
- // 正常结束,非Cancel时,进行下一个动作
151
- this._slideNextStep();
152
- }
153
- },
154
- null
155
- )
156
- );
157
- this.$refs.sliderRef.jsvMaskView.StartAnimation(anim);
158
- this.animationCount += 1;
159
- }
160
- },
161
- _AnalyzeStyleChange() {
162
- if (this.$props.styleToken !== this.TokenProcessed) {
163
- // Token变化时,重新解析style array
164
- let style_list;
165
- if (this.layoutStyles instanceof Array) {
166
- style_list = this.layoutStyles;
167
- } else {
168
- style_list = [this.layoutStyles];
169
- }
170
- const layout_set = combinedStyles(style_list, true);
171
- this.LayoutStyle = layout_set.combinedStyle;
172
- if (this.fontStyles) {
173
- if (this.fontStyles instanceof Array) {
174
- if (this.fontStyles[0] instanceof JsvStyleClass) {
175
- style_list = [...this.fontStyles, sCommonFontStyle];
176
- } else {
177
- style_list = this.fontStyles.map(
178
- (item) => new JsvStyleClass(item)
179
- );
180
- style_list.push(sCommonFontStyle);
81
+ const slideStep = () => {
82
+ if (animState == 0) {
83
+ // 文字从原始位置,移动出屏幕(每次完整移动,停顿1秒)
84
+ let start = 0,
85
+ end = fontStyle.value.direction == "rtl" ? textWidth : -textWidth;
86
+ animIdleHandler = setTimeout(() => {
87
+ animIdleHandler = -1;
88
+ const anim = new Forge.TranslateFrameAnimation(
89
+ start,
90
+ end,
91
+ props.slideSpeed,
92
+ true,
93
+ 0,
94
+ 0
95
+ );
96
+ anim.SetAnimationListener(
97
+ new Forge.AnimationListener(
98
+ null,
99
+ (ended) => {
100
+ if (ended) {
101
+ // 正常结束,非Cancel时,进行下一个动作
102
+ slideStep();
181
103
  }
182
- } else {
183
- style_list = [
184
- this.fontStyles instanceof JsvStyleClass
185
- ? this.fontStyles
186
- : new JsvStyleClass(this.fontStyles),
187
- sCommonFontStyle,
188
- ];
104
+ },
105
+ null
106
+ )
107
+ );
108
+ anim.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
109
+ toRaw(slideDiv.value).jsvGetProxyView(true).StartAnimation(anim);
110
+ animState = 1;
111
+ }, 1000);
112
+ } else {
113
+ // 文字从屏幕外部,移动回屏幕中的文字原始位置
114
+ let start =
115
+ fontStyle.value.direction == "rtl" ? -props.style.width : props.style.width,
116
+ end = 0;
117
+ const anim = new Forge.TranslateFrameAnimation(
118
+ start,
119
+ end,
120
+ props.slideSpeed,
121
+ true,
122
+ props.style.width,
123
+ 0
124
+ );
125
+ anim.SetAnimationListener(
126
+ new Forge.AnimationListener(
127
+ null,
128
+ (ended) => {
129
+ if (ended) {
130
+ // 正常结束,非Cancel时,进行下一个动作
131
+ slideStep();
189
132
  }
190
- const font_set = combinedStyles(style_list);
191
- this.FontStyle = font_set.combinedStyle;
192
- this.FontStyleClass = font_set.combinedClass;
193
- }
133
+ },
134
+ null
135
+ )
136
+ );
137
+ toRaw(slideDiv.value.jsvGetProxyView(true)).StartAnimation(anim);
138
+ animState = 0;
139
+ }
140
+ };
194
141
 
195
- if (this.FontStyleClass && this.FontStyleClass.length === 0) {
196
- this.FontStyleClass = null;
197
- }
198
- this.TokenProcessed = this.styleToken;
199
- }
200
- },
201
- },
202
- created() {
203
- this._AnalyzeStyleChange();
204
- },
205
- mounted() {
206
- this._asyncStartSlider();
207
- },
208
- unmounted() {
209
- // 清理所有异步处理,并停止Slider动作
210
- if (this.asyncTextLenTimer >= 0) {
211
- clearTimeout(this.asyncTextLenTimer);
212
- this.asyncTextLenTimer = -1;
142
+ const stopSlide = () => {
143
+ if (animIdleHandler > 0) {
144
+ clearTimeout(animIdleHandler);
145
+ animIdleHandler = -1;
146
+ }
147
+ animState = 0;
148
+ toRaw(slideDiv.value?.jsvGetProxyView(true))?.StopAnimation();
149
+ };
150
+
151
+ const asyncStartAnim = () => {
152
+ stopSlide();
153
+ // 稍进行延迟,以等待JsView的native端描绘文字并回传文字宽度
154
+ if (asyncStartHandler > 0) {
155
+ clearTimeout(asyncStartHandler);
156
+ }
157
+ asyncStartHandler = setTimeout(() => {
158
+ if (textWidth <= 0) {
159
+ textWidth = textDiv.value.clientWidth;
213
160
  }
214
- this._resetSlider();
215
- },
161
+ if (props.forceSlide || textWidth > props.style.width) {
162
+ slideStep();
163
+ }
164
+ asyncStartHandler = -1;
165
+ }, 500);
216
166
  };
167
+
168
+ onMounted(() => {
169
+ if (fontStyle.value.direction == "ltr") {
170
+ //普通的ltr文字异步通过clientWidth获取文字宽度
171
+ asyncStartAnim();
172
+ } else {
173
+ if (props.forceSlide || textWidth > props.style.width) {
174
+ slideStep();
175
+ }
176
+ }
177
+ });
178
+
179
+ onBeforeUnmount(() => {
180
+ clearTimeout(asyncStartHandler);
181
+ asyncStartHandler = -1;
182
+ stopSlide();
183
+ });
217
184
  </script>
218
185
 
219
186
  <template>
220
- <div :style="{ ...LayoutStyle, overflow: 'hidden' }">
187
+ <div
188
+ :style="{
189
+ left: style.left,
190
+ top: style.top,
191
+ width: style.width,
192
+ height: style.height,
193
+ overflow: 'hidden',
194
+ }"
195
+ >
221
196
  <div
222
- ref="sliderRef"
197
+ ref="slideDiv"
223
198
  :style="{
224
- left: 0,
199
+ left: slideDivLeft,
225
200
  top: 0,
226
- width: LayoutStyle.width,
227
- height: LayoutStyle.height,
201
+ width: style.width,
202
+ height: style.height,
228
203
  }"
229
204
  >
230
205
  <div
231
- ref="textRef"
232
- :className="_className"
233
- :style="{ ...FontStyle, height: LayoutStyle.height }"
234
- :jsv_text_align_minwidth="LayoutStyle.width"
235
- jsv-inherit-class="2"
206
+ ref="textDiv"
207
+ :style="{ ...fontStyle, height: style.height }"
208
+ :jsv_text_align_minwidth="style.width"
236
209
  >
237
210
  {{ text }}
238
211
  </div>
239
212
  </div>
240
213
  </div>
241
- </template>
214
+ </template>
@@ -12,7 +12,7 @@
12
12
  *
13
13
  -->
14
14
  <script>
15
- import { Forge, ForgeExtension } from "../../dom/jsv-forge-define";
15
+ import { Forge, ForgeExtension } from "../../../jsview/dom/jsv-forge-define";
16
16
  export default {
17
17
  props: {
18
18
  class: {
@@ -110,7 +110,7 @@ export default {
110
110
  const canvas = window.originDocument.createElement("canvas");
111
111
  canvas.style.width = this.style.width + "px";
112
112
  canvas.style.height = this.style.height + "px";
113
- this.$refs.innerView?.jsvMaskView.Element.appendChild(canvas);
113
+ this.$refs.innerView?.jsvGetProxyView(true).Element.appendChild(canvas);
114
114
 
115
115
  const clip_image = new Image();
116
116
  const bg_image = new Image();