@shijiu/jsview-vue 0.9.602 → 0.9.684

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 (86) 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/bin/jsview-engine-js-browser.min.js +1 -0
  4. package/dom/target_core_revision.js +4 -4
  5. package/package.json +1 -1
  6. package/samples/Basic/components/text/TextOverflow.vue +10 -5
  7. package/samples/Collision/App.vue +452 -0
  8. package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
  9. package/samples/DemoHomepage/router.js +25 -0
  10. package/samples/DemoHomepage/views/Homepage.vue +3 -10
  11. package/samples/ImpactStop/App.vue +435 -0
  12. package/samples/Input/App.vue +8 -17
  13. package/samples/Input/InputPanel.vue +18 -11
  14. package/samples/Marquee/App.vue +176 -40
  15. package/samples/Marquee/longText.js +14 -0
  16. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  17. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +1 -1
  18. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  19. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  20. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  21. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  22. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  23. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  24. package/samples/MetroWidgetDemos/Item.vue +20 -2
  25. package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
  26. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
  27. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
  28. package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +2 -10
  29. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
  30. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  31. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  32. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +4 -4
  33. package/samples/MetroWidgetDemos/data.js +2 -1
  34. package/samples/Preload/App.vue +16 -11
  35. package/samples/ScaleDownNeon/App.vue +107 -0
  36. package/samples/TextBox/App.vue +7 -81
  37. package/samples/TextBox/RenderCenter.vue +40 -16
  38. package/samples/TextBox/RenderLeft.vue +48 -19
  39. package/samples/TextBox/RenderOneLine.vue +30 -49
  40. package/samples/TextBox/RenderRight.vue +40 -16
  41. package/samples/TextShadowDemo/App.vue +11 -17
  42. package/samples/TextureAnimation/App2.vue +111 -0
  43. package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  44. package/samples/TextureAnimation/assets/light.png +0 -0
  45. package/samples/TextureAnimation/assets/light2.png +0 -0
  46. package/samples/TextureAnimation/assets/mask.png +0 -0
  47. package/samples/TextureSize/App.vue +3 -3
  48. package/samples/VisibleSensorDemo/App.vue +92 -25
  49. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  50. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +188 -80
  51. package/utils/JsViewEngineWidget/TemplateParser.js +89 -32
  52. package/utils/JsViewEngineWidget/WidgetCommon.js +3 -4
  53. package/utils/JsViewEngineWidget/index.js +3 -2
  54. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
  55. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +25 -3
  56. package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
  57. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  58. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  59. package/utils/JsViewVueTools/index.js +2 -1
  60. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  61. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
  62. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
  63. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
  64. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
  65. package/utils/JsViewVueWidget/JsvMarquee.vue +178 -205
  66. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  67. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  68. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +37 -41
  69. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
  70. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +18 -2
  71. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +22 -2
  72. package/utils/JsViewVueWidget/JsvTextBox.vue +35 -72
  73. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +123 -46
  74. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
  75. package/utils/JsViewVueWidget/JsvTouchContainer.vue +3 -4
  76. package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
  77. package/utils/JsViewVueWidget/index.js +2 -2
  78. package/utils/JsViewVueWidget/utils/index.js +8 -0
  79. package/utils/JsViewVueWidget/utils/text.js +19 -0
  80. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  81. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  82. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  83. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  84. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  85. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  86. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -29,6 +29,7 @@
29
29
  <script>
30
30
  import Indicator from "./Indicator.vue";
31
31
  import { ref } from "vue";
32
+ import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
32
33
 
33
34
  const VIEW_NUM = 4;
34
35
 
@@ -45,7 +46,7 @@ function modToRange(value, mod, start = 0) {
45
46
  window.modToRange = modToRange;
46
47
 
47
48
  export default {
48
- components: { Indicator },
49
+ components: { Indicator, JsvVisibleSensor },
49
50
  props: {
50
51
  showIndicator: {
51
52
  type: Boolean,
@@ -124,7 +125,7 @@ export default {
124
125
  reverseSwipe: {
125
126
  type: Boolean,
126
127
  default: false,
127
- }
128
+ },
128
129
  },
129
130
  computed: {
130
131
  indicatorLayout() {
@@ -320,6 +321,10 @@ export default {
320
321
  }, this.autoplayInterval);
321
322
  }
322
323
  },
324
+ _stopAutoPlay() {
325
+ clearInterval(this.intervalHandler);
326
+ this.intervalHandler = -1;
327
+ },
323
328
  _onFocus() {
324
329
  this.focused = true;
325
330
  clearInterval(this.intervalHandler);
@@ -330,6 +335,13 @@ export default {
330
335
  this._enableAutoplay();
331
336
  this.onBlur?.();
332
337
  },
338
+ onBeVisible(old_h, new_h, old_v, new_v) {
339
+ if ((old_h && !new_h) || (old_v && !new_h)) {
340
+ this._stopAutoPlay();
341
+ } else if ((!old_h && new_h) || (!old_v && new_h)) {
342
+ this._enableAutoplay();
343
+ }
344
+ },
333
345
  },
334
346
  created() {
335
347
  this._enableAutoplay();
@@ -338,6 +350,14 @@ export default {
338
350
  </script>
339
351
 
340
352
  <template>
353
+ <jsv-visible-sensor
354
+ :horizonShown="0.2"
355
+ :verticalShown="0.2"
356
+ :width="layoutInfo.widgetWidth"
357
+ :height="layoutInfo.widgetHeight"
358
+ :enable="true"
359
+ :callback="onBeVisible"
360
+ ></jsv-visible-sensor>
341
361
  <jsv-focus-block
342
362
  :name="name"
343
363
  :onAction="{
@@ -6,94 +6,54 @@
6
6
  * JsvTextBox:Vue高阶组件,文字的垂直对齐方式显示控件
7
7
  * props说明:
8
8
  * verticalAlign {string} 垂直对齐方式 (必需) top、middle、bottom
9
- * stylesList {array} 布局样式(必需),数组中可包含样式对象或者JsvStyleClass,或者JsvTextStyleClass对象,
10
- * 样式对象内容为{left:0, top:0, width:xxx, height:xxx},
11
- * 布局样式为数组中所有样式的合并。
12
- * styleToken {string} 类似于react html元素的key,当style变化时,由使用者改变此Token通知hoc进行style重新识别。
13
- * Token不变的场景,props变化不会引起render,以提高渲染性能
9
+ * style {object} 样式(必需)
14
10
  * enableLatex {bool} 是否启用Latex文字描画模式
15
11
  -->
16
12
 
17
- <script>
18
- import {
19
- JsvTextStyleClass,
20
- combinedStyles,
21
- } from "jsview/utils/JsViewVueTools/JsvStyleClass.js";
13
+ <script setup>
14
+ import { ref, computed } from "vue";
22
15
 
23
- let sAreaAlignStyleMap = new Map();
24
- export default {
25
- props: {
26
- styleToken: String,
27
- stylesList: Object,
28
- verticalAlign: {
29
- type: String,
30
- default: "middle",
31
- },
32
- lineAlign: {
33
- type: String,
34
- default: "middle",
35
- },
36
- enableLatex: Boolean,
16
+ const props = defineProps({
17
+ style: Object,
18
+ verticalAlign: {
19
+ type: String,
20
+ default: "middle",
37
21
  },
38
- data() {
39
- return {
40
- styleCombined: null,
41
- styleClasses: null,
42
- tokenProcesses: null,
43
- };
22
+ lineAlign: {
23
+ type: String,
24
+ default: "middle",
44
25
  },
45
- beforeMount() {
46
- if (this.styleToken !== this.tokenProcesses) {
47
- // Token变化时,重新解析style array
48
- const style_set = combinedStyles(
49
- this.stylesList,
50
- !window.JsvDisableReactWrapper // 无ReactWrapper时,全解析style属性
51
- );
26
+ enableLatex: Boolean,
27
+ className: String,
28
+ });
52
29
 
53
- this.styleCombined = style_set.combinedStyle;
54
- // console.log("styleCombined = ", this.styleCombined);
55
- if (!window.JsvDisableReactWrapper) {
56
- this.styleClasses = style_set.combinedClass;
57
- let key = this.verticalAlign + "_" + this.lineAlign;
58
- if (!sAreaAlignStyleMap.has(key)) {
59
- const text_class = new JsvTextStyleClass({});
60
- text_class.setVerticalAlign(this.verticalAlign);
61
- text_class.setLineAlign(this.lineAlign);
62
- sAreaAlignStyleMap.set(key, text_class);
63
- }
64
- const va_set_class = sAreaAlignStyleMap.get(key);
65
- if (this.styleClasses.length === 0) {
66
- this.styleClasses += va_set_class.getName();
67
- } else {
68
- this.styleClasses = this.styleClasses + " " + va_set_class.getName();
69
- }
70
- }
71
- this.tokenProcesses = this.styleToken;
72
- }
73
- },
74
- methods: {
75
- isJsvDisableReactWrapper() {
76
- if (window.JsvDisableReactWrapper) {
77
- return true;
78
- }
79
- return false;
80
- },
81
- },
82
- };
30
+ const innerStyle = computed(() => {
31
+ let result = { ...props.style };
32
+ if (!result.verticalAlign) {
33
+ result.verticalAlign = props.verticalAlign;
34
+ }
35
+ if (!result.lineAlign) {
36
+ result.lineAlign = props.lineAlign;
37
+ }
38
+ return result;
39
+ });
40
+ const disable = window.JsvDisableReactWrapper;
83
41
  </script>
84
42
 
85
43
  <template>
86
44
  <div>
87
- <div v-if="isJsvDisableReactWrapper()" :style="styleCombined">
45
+ <div v-if="disable" :style="style">
88
46
  <div :style="{ position: 'static', display: 'table' }">
89
47
  <div
48
+ :className="className"
90
49
  :style="{
91
50
  position: 'static',
92
51
  display: 'table-cell',
93
- width: styleCombined.width,
94
- height: styleCombined.height,
52
+ width: style.width,
53
+ height: style.height,
95
54
  verticalAlign: verticalAlign,
96
55
  }"
56
+ jsv-inherit-class="2"
97
57
  >
98
58
  <slot></slot>
99
59
  </div>
@@ -101,9 +61,12 @@ export default {
101
61
  </div>
102
62
  <div
103
63
  v-else
104
- :className="styleClasses"
105
- :style="{ ...styleCombined }"
64
+ :className="className"
65
+ :style="style"
106
66
  :jsv_text_latex_enable="enableLatex ? 'true' : ''"
67
+ :jsv_text_vertical_align="verticalAlign"
68
+ :jsv_text_line_align="lineAlign"
69
+ jsv-inherit-class="1"
107
70
  >
108
71
  <slot></slot>
109
72
  </div>
@@ -2,14 +2,20 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-02-07 14:21:37
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-02-21 10:35:18
5
+ * @LastEditTime: 2022-08-24 13:18:21
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
9
  import { Forge, ForgeExtension } from "../../../dom/jsv-forge-define";
10
- import { numberCheckSet, urlCheckSet } from "../../JsViewVueTools/TypeCheckAndSet";
11
- import { toNinePatchForgeViewSet } from "../../JsViewVueTools/NinePatchHelper"
12
- import { DECORATE_BORDER_RADIUS, DECORATE_NINEPATCH_ALPHA_MIX } from "./CommonType"
10
+ import {
11
+ numberCheckSet,
12
+ urlCheckSet,
13
+ } from "../../JsViewVueTools/TypeCheckAndSet";
14
+ import { toNinePatchForgeViewSet } from "../../JsViewVueTools/NinePatchHelper";
15
+ import {
16
+ DECORATE_BORDER_RADIUS,
17
+ DECORATE_NINEPATCH_ALPHA_MIX,
18
+ } from "./CommonType";
13
19
 
14
20
  /*
15
21
  * JsvTextureAnim:对view的内容进行动画的控件
@@ -29,23 +35,23 @@ import { DECORATE_BORDER_RADIUS, DECORATE_NINEPATCH_ALPHA_MIX } from "./CommonTy
29
35
  * bottomLeft {number}: // 左下角圆弧半径 默认 0
30
36
  * bottomRight {number}: // 右下角圆弧半径 默认 0
31
37
  * }
32
- *
38
+ *
33
39
  * NinePatchAlphaMix NinePatch图片的alpha叠加
34
40
  * {
35
41
  * type {string}: // 装饰类型,固定值"NinePatchAlphaMix"
36
42
  * url {string}: // (必填)Alpha mix叠加的图片
37
43
  * imageWidth {int} // (必填)原图信息: 原图的宽度(由于正方形,宽高相同)
38
44
  * centerWidth {int} // (必填)原图信息: .9图的中心区域宽度(repeat区域)
39
- * imageDspWidth {int} // (选填)原图缩放后的显示宽度,计算方法:
45
+ * imageDspWidth {int} // (选填)原图缩放后的显示宽度,计算方法:
40
46
  * 四角为90度圆弧时: imageDspWidth = 显示图形的圆弧半径 / 原图中圆弧的半径 * 原图宽度
41
47
  * 原图中圆弧半径 = (原图宽度 - borderOutset * 2) / 2
42
48
  * 四角为其他形状时,原图.9图的四角区域,缩放到要和显示图形重合后的宽度。
43
49
  * borderOutset {int} // (必填)原图信息: 图片边缘到中心内容区域边缘的距离, 快速计算: (原图宽度 - 原图中放内容宽度) / 2
44
50
  * animTime {int} // (必填)缩放动画的时长(单位毫秒)
45
51
  * }
46
- *
52
+ *
47
53
  * animation {string} texture的动画, 为keyframe的格式
48
- * duration {number} 动画时长, 毫秒
54
+ * duration {number} 动画时长, 毫秒
49
55
  * onAnimationEnd {function} 动画结束回调
50
56
  * repeat {number} 动画执行次数, 默认1次, -1为无限循环
51
57
  * delay {number} 动画延迟时间, 毫秒
@@ -53,11 +59,29 @@ import { DECORATE_BORDER_RADIUS, DECORATE_NINEPATCH_ALPHA_MIX } from "./CommonTy
53
59
  * autoStart {boolean} 是否自动开始动画, 默认 false
54
60
  * transform {string} texture的transform, 计算时transform矩阵在动画矩阵右侧
55
61
  * transformOrigin {string} transform的锚点, 锚点不设置的话默认为中心点(0.5, 0.5)
56
- *
62
+ * texCoord {object} {
63
+ * alignAnchor: 偏差的基准点, 具体为TexAlignAnchor的enum
64
+ * left: 距离anchor的偏差
65
+ * top: 距离anchor的偏差
66
+ * width: texture的宽
67
+ * height: texture的高
68
+ * }
57
69
  * public methods:
58
70
  * start
59
71
  * @description 开始动画
60
72
  */
73
+ const TexAlignAnchor = {
74
+ LEFT_TOP: 1,
75
+ CENTER_TOP: 2,
76
+ RIGHT_TOP: 3,
77
+ LEFT_MIDDLE: 4,
78
+ CENTER: 5,
79
+ RIGHT_MIDDLE: 6,
80
+ LEFT_BOTTOM: 7,
81
+ CENTER_BOTTOM: 8,
82
+ RIGHT_BOTTOM: 9,
83
+ };
84
+ export { TexAlignAnchor };
61
85
 
62
86
  export default {
63
87
  props: {
@@ -88,7 +112,18 @@ export default {
88
112
  autoStart: {
89
113
  type: Boolean,
90
114
  default: false,
91
- }
115
+ },
116
+ texCoord: {
117
+ type: Object,
118
+ },
119
+ },
120
+ watch: {
121
+ texCoord: {
122
+ handler(newValue, oldValue) {
123
+ this._updateTexCoord();
124
+ },
125
+ deep: true,
126
+ },
92
127
  },
93
128
  setup() {
94
129
  return {
@@ -100,7 +135,10 @@ export default {
100
135
  methods: {
101
136
  _createForgeView(view_texture, decorate_setting) {
102
137
  if (decorate_setting) {
103
- return this._createLayoutViewWithDecorate(view_texture, decorate_setting);
138
+ return this._createLayoutViewWithDecorate(
139
+ view_texture,
140
+ decorate_setting
141
+ );
104
142
  } else {
105
143
  // 无特异修饰类型的view
106
144
  let texture_set = new Forge.ExternalTextureSetting(view_texture);
@@ -120,24 +158,27 @@ export default {
120
158
  topLeft: top_left,
121
159
  topRight: top_right,
122
160
  bottomRight: match.length > 2 ? match[2] : top_left,
123
- bottomLeft: match.length > 3 ? match[3] : top_right
124
- }
161
+ bottomLeft: match.length > 3 ? match[3] : top_right,
162
+ };
125
163
  }
126
164
  }
127
165
  return null;
128
166
  },
129
167
 
130
168
  _createLayoutViewWithDecorate(view_texture, decorate_setting) {
131
- if (decorate_setting && typeof decorate_setting == 'object') {
132
- switch(decorate_setting.type) {
169
+ if (decorate_setting && typeof decorate_setting == "object") {
170
+ switch (decorate_setting.type) {
133
171
  case DECORATE_NINEPATCH_ALPHA_MIX: {
134
172
  // NinePatch alpha mix view
135
- return this._createNinePatchAlphaMixView(view_texture, decorate_setting);
136
- };
173
+ return this._createNinePatchAlphaMixView(
174
+ view_texture,
175
+ decorate_setting
176
+ );
177
+ }
137
178
  case DECORATE_BORDER_RADIUS: {
138
179
  // 圆角view
139
180
  return this._createBorderRadius(view_texture, decorate_setting);
140
- };
181
+ }
141
182
  default:
142
183
  console.error("Unknown set=", decorate_setting);
143
184
  return null;
@@ -157,8 +198,7 @@ export default {
157
198
  if (decorate_setting.url) {
158
199
  let converted_url = urlCheckSet(decorate_setting.url);
159
200
  let view_texture = textureManager.GetImage2(converted_url);
160
-
161
- nine_patch_view.EnableAlphaMix(view_texture, true);
201
+ nine_patch_view.EnableAlphaMix(view_texture);
162
202
  } else {
163
203
  console.error("ninepatch url not set");
164
204
  return null;
@@ -166,13 +206,17 @@ export default {
166
206
 
167
207
  // calculate padding and repeat
168
208
  let view_set = toNinePatchForgeViewSet(
169
- numberCheckSet(decorate_setting.imageWidth),
170
- numberCheckSet(decorate_setting.centerWidth),
171
- decorate_setting.imageDspWidth,
172
- numberCheckSet(decorate_setting.borderOutset));
209
+ numberCheckSet(decorate_setting.imageWidth),
210
+ numberCheckSet(decorate_setting.centerWidth),
211
+ decorate_setting.imageDspWidth,
212
+ numberCheckSet(decorate_setting.borderOutset)
213
+ );
173
214
  nine_patch_view.SetPadding(view_set.padding, view_set.padding); // 方图横纵一致
174
215
  nine_patch_view.SetRepeat(view_set.repeat, view_set.repeat); // 方图横纵一致
175
- nine_patch_view.SetImageDspSize(view_set.imageDspSize, view_set.imageDspSize); // 方图横纵一致
216
+ nine_patch_view.SetImageDspSize(
217
+ view_set.imageDspSize,
218
+ view_set.imageDspSize
219
+ ); // 方图横纵一致
176
220
 
177
221
  return nine_patch_view;
178
222
  },
@@ -180,11 +224,15 @@ export default {
180
224
  _createBorderRadius(view_texture, decorate_setting) {
181
225
  // 圆角view
182
226
  let texture_mask = new Forge.ViewRoundCornerMask(
183
- numberCheckSet(decorate_setting.topLeft),
184
- numberCheckSet(decorate_setting.topRight),
185
- numberCheckSet(decorate_setting.bottomLeft),
186
- numberCheckSet(decorate_setting.bottomRight));
187
- let texture_set = new Forge.ExternalTextureSetting(view_texture, texture_mask);
227
+ numberCheckSet(decorate_setting.topLeft),
228
+ numberCheckSet(decorate_setting.topRight),
229
+ numberCheckSet(decorate_setting.bottomLeft),
230
+ numberCheckSet(decorate_setting.bottomRight)
231
+ );
232
+ let texture_set = new Forge.ExternalTextureSetting(
233
+ view_texture,
234
+ texture_mask
235
+ );
188
236
  return new Forge.LayoutView(texture_set);
189
237
  },
190
238
 
@@ -192,6 +240,31 @@ export default {
192
240
  this.onAnimationEnd?.();
193
241
  },
194
242
 
243
+ _updateTexCoord() {
244
+ if (this.texCoord) {
245
+ if (this.texCoord.width > 0 && this.texCoord.height > 0) {
246
+ const offsetLeft = !isNaN(this.texCoord.left)
247
+ ? this.texCoord.left
248
+ : -this.texCoord.width / 2;
249
+ const offsetTop = !isNaN(this.texCoord.top)
250
+ ? this.texCoord.top
251
+ : -this.texCoord.height / 2;
252
+ const anchor = Number.isInteger(this.texCoord.alignAnchor)
253
+ ? this.texCoord.alignAnchor
254
+ : 5;
255
+ this.innerView.SetTextureCoord(
256
+ offsetLeft,
257
+ offsetTop,
258
+ this.texCoord.width,
259
+ this.texCoord.height,
260
+ anchor
261
+ );
262
+ } else {
263
+ console.error("JsvTextureAnim");
264
+ }
265
+ }
266
+ },
267
+
195
268
  start() {
196
269
  if (this.forgeAnimation && this.innerView) {
197
270
  this.innerView.StartTextureAnimation(this.forgeAnimation);
@@ -200,16 +273,20 @@ export default {
200
273
 
201
274
  getTransition() {
202
275
  let transition = "";
203
- let decorate = this.$props.decorate;
276
+ let decorate = this.decorate;
204
277
 
205
- if (decorate && decorate.type == DECORATE_NINEPATCH_ALPHA_MIX && decorate.animTime > 0) {
278
+ if (
279
+ decorate &&
280
+ decorate.type == DECORATE_NINEPATCH_ALPHA_MIX &&
281
+ decorate.animTime > 0
282
+ ) {
206
283
  // Ninepatch模式可以设置长宽的过渡动画
207
284
  let anim_time = decorate.animTime;
208
285
  transition = `left ${anim_time}s, top ${anim_time}s, width ${anim_time}s, height ${anim_time}s`;
209
286
  }
210
287
 
211
288
  return transition;
212
- }
289
+ },
213
290
  },
214
291
 
215
292
  created() {
@@ -218,8 +295,13 @@ export default {
218
295
 
219
296
  // 1.获得主view的展示内容图片 texture
220
297
  let image_url = urlCheckSet(this.src);
221
- let view_texture = textureManager.GetImage2(image_url, false, null, "RGB_8888", null);
222
-
298
+ let view_texture = textureManager.GetImage2(
299
+ image_url,
300
+ false,
301
+ null,
302
+ "RGB_8888",
303
+ null
304
+ );
223
305
  // 1.1 兼容border转为decorate
224
306
  let decorate = this.$props.decorate;
225
307
  if (this.$props.borderRadius) {
@@ -228,7 +310,6 @@ export default {
228
310
 
229
311
  // 2.创建view
230
312
  this.innerView = this._createForgeView(view_texture, decorate);
231
-
232
313
  // 3.设置texture基本形变
233
314
  if (this.transform) {
234
315
  this.innerView.ResetTextureCssTransform(
@@ -236,6 +317,7 @@ export default {
236
317
  this.transformOrigin
237
318
  );
238
319
  }
320
+ this._updateTexCoord();
239
321
 
240
322
  // 4.设置texture的动画形变
241
323
  if (this.animation) {
@@ -248,11 +330,7 @@ export default {
248
330
  );
249
331
  this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
250
332
  this.forgeAnimation.SetAnimationListener(
251
- new Forge.AnimationListener(
252
- null,
253
- this._onAnimationEnd,
254
- null
255
- )
333
+ new Forge.AnimationListener(null, this._onAnimationEnd, null)
256
334
  );
257
335
  } else {
258
336
  this.forgeAnimation = null;
@@ -283,15 +361,14 @@ export default {
283
361
  </script>
284
362
 
285
363
  <template>
286
- <div
364
+ <div
287
365
  :style="{
288
366
  top: top,
289
- left: left,
367
+ left: left,
290
368
  width: width,
291
369
  height: height,
292
370
  transition: getTransition(),
293
371
  }"
294
- :jsv_innerview="innerViewId">
295
-
296
- </div>
372
+ :jsv_innerview="innerViewId"
373
+ ></div>
297
374
  </template>
@@ -2,16 +2,20 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-10-13 15:14:29
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-02-11 13:34:48
5
+ * @LastEditTime: 2022-08-18 11:17:37
6
6
  * @Description: file content
7
7
  */
8
8
  //考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
9
9
  import * as JsvTextureAnim from "./JsvTextureAnim.vue";
10
- console.log("cchtest texture anim", JsvTextureAnim)
11
10
  let _JsvTextureAnim = JsvTextureAnim;
12
- if (window.JsvWidgetWrapperGroup && window.JsvWidgetWrapperGroup.BrowserTextureAnim) {
11
+ if (
12
+ window.JsvWidgetWrapperGroup &&
13
+ window.JsvWidgetWrapperGroup.BrowserTextureAnim
14
+ ) {
13
15
  _JsvTextureAnim = window.JsvWidgetWrapperGroup.BrowserTextureAnim;
14
16
  }
15
17
 
16
- export * from "./CommonType"
17
- export default _JsvTextureAnim.default
18
+ export * from "./CommonType";
19
+ export default _JsvTextureAnim.default;
20
+ const TexAlignAnchor = JsvTextureAnim.TexAlignAnchor;
21
+ export { TexAlignAnchor };
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-04-10 20:46:53
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-04-10 23:07:54
5
+ * @LastEditTime: 2022-11-07 14:43:44
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -68,7 +68,6 @@ export default {
68
68
  mounted() {
69
69
  if (this.$refs.touchContainer && this.$refs.touchContainer.jsvMaskView) {
70
70
  const view = this.$refs.touchContainer.jsvMaskView;
71
- const view_lp = view.GetLayoutParams();
72
71
  const page_width = this.flingPageWidth;
73
72
  const page_edge = this.flingPageEdge;
74
73
  const direction = this.direction;
@@ -80,13 +79,13 @@ export default {
80
79
  x: 0,
81
80
  y: 0,
82
81
  width: page_width,
83
- height: view_lp.Height,
82
+ height: this.$refs.touchContainer.style.height,
84
83
  };
85
84
  } else {
86
85
  drag_limit_area = {
87
86
  x: 0,
88
87
  y: 0,
89
- width: view_lp.Width,
88
+ width: this.$refs.touchContainer.style.width,
90
89
  height: page_width,
91
90
  };
92
91
  }
@@ -10,21 +10,18 @@
10
10
  -->
11
11
 
12
12
  <script>
13
- import { Options, Vue } from "vue-class-component";
14
-
15
- @Options({
13
+ export default {
16
14
  props: {
17
- onRef: { type: Function, default: () => {} },
18
- useTexture: { type: Boolean, default: false },
15
+ onRef: {
16
+ type: Function,
17
+ default: () => {}
18
+ },
19
+ useTexture: {
20
+ type: Boolean,
21
+ default: false
22
+ },
19
23
  },
20
- })
21
- class JsvVideo extends Vue {
22
- constructor(props) {
23
- super(props);
24
- }
25
24
  }
26
-
27
- export default JsvVideo;
28
25
  </script>
29
26
 
30
27
  <template>
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-07-05 11:00:51
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-07-08 17:08:08
5
+ * @LastEditTime: 2022-08-18 13:17:17
6
6
  * @Description: file content
7
7
  */
8
8
  export { default as JsvActorMove, JsvActorMoveControl } from "./JsvActorMove";
@@ -18,7 +18,7 @@ export { default as JsvSpray } from "./JsvSpray";
18
18
  export { default as JsvSpriteAnim, SpriteController } from "./JsvSpriteAnim";
19
19
  export { default as JsvSwiper } from "./JsvSwiper";
20
20
  export { default as JsvSwiper3D } from "./JsvSwiper3D";
21
- export { default as JsvTextureAnim } from "./JsvTextureAnim";
21
+ export { default as JsvTextureAnim, TexAlignAnchor, DECORATE_NINEPATCH_ALPHA_MIX, DECORATE_BORDER_RADIUS } from "./JsvTextureAnim";
22
22
  export { default as JsvVisibleSensor } from "./JsvVisibleSensor";
23
23
  export { default as JsvFilterView } from "./JsvFilterView.vue";
24
24
  export {
@@ -0,0 +1,8 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-11-09 15:18:52
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-11-09 15:18:52
6
+ * @Description: file content
7
+ */
8
+ export * from "./text"
@@ -0,0 +1,19 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-11-09 15:18:43
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-11-10 15:02:54
6
+ * @Description: file content
7
+ */
8
+ const getTextWidth = (text, style) => {
9
+ const textParams = {
10
+ str: text ? text : "",
11
+ font: style.fontFamily ? style.fontFamily : Forge.TextUtils._sDefaultFont,
12
+ size: style.fontSize ? style.fontSize : Forge.TextUtils._sDefaultFontSize,
13
+ italic: style.fontStyle === "italic" ? "italic" : "",
14
+ bold: style.fontWeight === "bold" ? "bold" : "",
15
+ };
16
+ return window.PlatformUtils.GetTextWidth(textParams);
17
+ };
18
+
19
+ export { getTextWidth };