@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
@@ -33,7 +33,6 @@
33
33
  * 功能: 停止精灵图动画,可选择静止在第一帧或最后一帧
34
34
  -->
35
35
  <script>
36
- import {Options, Vue} from "vue-class-component";
37
36
  import { getKeyFramesGroup } from '../../JsViewVueTools/JsvDynamicKeyFrames.js'
38
37
 
39
38
 
@@ -71,7 +70,7 @@ function _createTransformStyle(w_scale, h_scale, x, y) {
71
70
  return output;
72
71
  }
73
72
 
74
- @Options({
73
+ export default {
75
74
  props: {
76
75
  spriteInfo: Object,
77
76
  viewSize: Object,
@@ -82,11 +81,9 @@ function _createTransformStyle(w_scale, h_scale, x, y) {
82
81
  loop: Number,
83
82
  spriteName: String,
84
83
  controller: Object,
85
- }
86
- })
87
- class JsvSpriteAnim extends Vue {
88
- constructor(props) {
89
- super(props);
84
+ },
85
+
86
+ created() {
90
87
  let stopFrame = "start";
91
88
  if (typeof this.$props.autostart === "string" && this.$props.autostart !== "none") {
92
89
  stopFrame = this.$props.autostart;
@@ -122,315 +119,315 @@ class JsvSpriteAnim extends Vue {
122
119
  this.blinkAnimCache = null;
123
120
  this.transform_style = this._AnalyzeProp();
124
121
  this.sAnimationToken = 0;
125
- }
126
-
127
- stop(end_frame) {
128
- if (this.$props.spriteInfo.frames && this.$props.spriteInfo.frames.length === 1) {
129
- return;
130
- }
131
- this.stopped = true;
132
- this.stopFrame = end_frame || this.stopFrame;
133
- }
122
+ },
134
123
 
135
- start(end_frame, duration) {
136
- if (this.$props.spriteInfo.frames && this.$props.spriteInfo.frames.length === 1) {
137
- return;
138
- }
139
- this.innerId += 1;
140
- this.stopped = false;
141
- this.spriteDuration = duration || this.$props.duration;
142
- this.stopFrame = end_frame || this.stopFrame;
143
- }
124
+ unmounted() {
125
+ this._clearExpiredKeyFrames();
126
+ },
144
127
 
145
- blink(alphas, duration, ease, delay, repeat) {
146
- // 注意:比较数组是否相同仅在此场景下使用toString,其他场景
147
- if (!this.blinkAnimCache
148
- || (this.blinkAnimCache.alphas.toString() !== alphas.toString()
149
- || this.blinkAnimCache.duration !== duration
150
- || this.blinkAnimCache.ease !== ease
151
- || this.blinkAnimCache.delay !== delay
152
- || this.blinkAnimCache.repeat !== repeat)) {
153
- const anim_name_base = this._getAnimNameBase();
154
- const anim_name_blink = `${anim_name_base}-blink`;
155
- let image_keyframs = `@keyframes ${anim_name_blink} {`;
156
- const frame_percent = 1 / (alphas.length);
157
- for (let i = 0; i < alphas.length; i++) {
158
- const alpha = alphas[i];
159
- let header;
160
- if (i !== alphas.length - 1) {
161
- header = `${parseFloat(frame_percent * i * 100).toFixed(2)}% {`;
162
- } else {
163
- header = '100% {';
128
+ methods: {
129
+ stop(end_frame) {
130
+ if (this.$props.spriteInfo.frames && this.$props.spriteInfo.frames.length === 1) {
131
+ return;
164
132
  }
165
- image_keyframs += header;
133
+ this.stopped = true;
134
+ this.stopFrame = end_frame || this.stopFrame;
135
+ },
166
136
 
167
- if (alpha) {
168
- const tr_str = ` opacity:${alpha};`;
169
- image_keyframs += tr_str;
137
+ start(end_frame, duration) {
138
+ if (this.$props.spriteInfo.frames && this.$props.spriteInfo.frames.length === 1) {
139
+ return;
140
+ }
141
+ this.innerId += 1;
142
+ this.stopped = false;
143
+ this.spriteDuration = duration || this.$props.duration;
144
+ this.stopFrame = end_frame || this.stopFrame;
145
+ },
146
+
147
+ blink(alphas, duration, ease, delay, repeat) {
148
+ // 注意:比较数组是否相同仅在此场景下使用toString,其他场景
149
+ if (!this.blinkAnimCache
150
+ || (this.blinkAnimCache.alphas.toString() !== alphas.toString()
151
+ || this.blinkAnimCache.duration !== duration
152
+ || this.blinkAnimCache.ease !== ease
153
+ || this.blinkAnimCache.delay !== delay
154
+ || this.blinkAnimCache.repeat !== repeat)) {
155
+ const anim_name_base = this._getAnimNameBase();
156
+ const anim_name_blink = `${anim_name_base}-blink`;
157
+ let image_keyframs = `@keyframes ${anim_name_blink} {`;
158
+ const frame_percent = 1 / (alphas.length);
159
+ for (let i = 0; i < alphas.length; i++) {
160
+ const alpha = alphas[i];
161
+ let header;
162
+ if (i !== alphas.length - 1) {
163
+ header = `${parseFloat(frame_percent * i * 100).toFixed(2)}% {`;
164
+ } else {
165
+ header = '100% {';
166
+ }
167
+ image_keyframs += header;
168
+
169
+ if (alpha) {
170
+ const tr_str = ` opacity:${alpha};`;
171
+ image_keyframs += tr_str;
172
+ }
173
+
174
+ image_keyframs += '}';
175
+ image_keyframs += "\n";
170
176
  }
171
-
172
177
  image_keyframs += '}';
173
- image_keyframs += "\n";
174
- }
175
- image_keyframs += '}';
176
- if (this.keyFrameStyleSheet) {
177
- this.keyFrameStyleSheet.insertRule(image_keyframs);
178
- }
179
- this.blinkAnimCache = {
180
- alphas,
181
- duration,
182
- ease,
183
- delay,
184
- repeat,
185
- blinkAnimName: anim_name_blink
186
- };
187
- }
188
-
189
- // 参数格式化
190
- ease = ease || "";
191
- delay = delay || 0;
192
- repeat = (repeat === -1) ? "infinite" : (repeat || 1);
193
-
194
- const animName = `${this.blinkAnimCache.blinkAnimName} ${duration}s ${ease} ${delay}s ${repeat}`;
195
- this.blinkAnim = animName;
196
- this.stopped = true;
197
- }
198
-
199
- _getAnimNameBase() {
200
- return this.$props.spriteName ? this.$props.spriteName : `sprite-anim-name-${this.sAnimationToken++}`;
201
- }
202
-
203
- _updateFrozeFrameCache(image_url, frame_info_list,
204
- canvas_width, canvas_height,
205
- source_width, source_height) {
206
- const cache = this.frozeFrameCache;
207
-
208
- const index = this.stopFrame === "start" ? 0 : frame_info_list.length - 1;
209
- const tr = _getTransformInfo(
210
- frame_info_list[index].source,
211
- frame_info_list[index].target,
212
- canvas_width,
213
- canvas_height
214
- );
215
-
216
- cache.clipStyle = {
217
- transform: _createTransformStyle(tr.csw, tr.csh, tr.cx, tr.cy),
218
- transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
219
- overflow: "hidden",
220
- left: 0,
221
- top: 0,
222
- width: canvas_width,
223
- height: canvas_height,
224
- };
225
-
226
- cache.transStyle = {
227
- transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
228
- transform: _createTransformStyle(tr.sw, tr.sh, tr.x, tr.y),
229
- width: source_width,
230
- height: source_height,
231
- };
232
-
233
- cache.imageStyle = {
234
- backgroundImage: image_url,
235
- width: source_width,
236
- height: source_height,
237
- };
238
- }
239
-
240
- _updateAnimateFrameCache(image_url, frame_info_list,
241
- canvas_width, canvas_height,
242
- source_width, source_height) {
243
- this._clearExpiredKeyFrames();
244
-
245
- if (!frame_info_list) { return; }
246
- const anim_name_base = this._getAnimNameBase();
247
- const frame_percent = 1 / (frame_info_list.length);
248
- const anim_name_clip = `${anim_name_base}-clip`;
249
- const anim_name_image = `${anim_name_base}-image`;
250
- let image_keyframs = `@keyframes ${anim_name_image} {`;
251
- let clip_keyframs = `@keyframes ${anim_name_clip} {`;
252
-
253
- for (let i = 0; i < frame_info_list.length + 1; i++) {
254
- let item;
255
- if (i !== frame_info_list.length) {
256
- item = frame_info_list[i];
257
- } else {
258
- // 追加一个最后一帧以保证最后一帧可见
259
- item = frame_info_list[frame_info_list.length - 1];
178
+ if (this.keyFrameStyleSheet) {
179
+ this.keyFrameStyleSheet.insertRule(image_keyframs);
260
180
  }
261
-
262
- // Header
263
- let header;
264
- if (i !== frame_info_list.length) {
265
- header = `${parseFloat(frame_percent * i * 100).toFixed(2)}% {`;
266
- } else {
267
- header = '100% {';
181
+ this.blinkAnimCache = {
182
+ alphas,
183
+ duration,
184
+ ease,
185
+ delay,
186
+ repeat,
187
+ blinkAnimName: anim_name_blink
188
+ };
268
189
  }
269
- image_keyframs += header;
270
- clip_keyframs += header;
271
190
 
272
- if (item.source) {
273
- const tr = _getTransformInfo(item.source, item.target, canvas_width, canvas_height);
274
- const clip_trans = _createTransformStyle(tr.csw, tr.csh, tr.cx, tr.cy);
275
- const image_trans = _createTransformStyle(tr.sw, tr.sh, tr.x, tr.y);
191
+ // 参数格式化
192
+ ease = ease || "";
193
+ delay = delay || 0;
194
+ repeat = (repeat === -1) ? "infinite" : (repeat || 1);
195
+
196
+ const animName = `${this.blinkAnimCache.blinkAnimName} ${duration}s ${ease} ${delay}s ${repeat}`;
197
+ this.blinkAnim = animName;
198
+ this.stopped = true;
199
+ },
200
+
201
+ _getAnimNameBase() {
202
+ return this.$props.spriteName ? this.$props.spriteName : `sprite-anim-name-${this.sAnimationToken++}`;
203
+ },
204
+
205
+ _updateFrozeFrameCache(image_url, frame_info_list,
206
+ canvas_width, canvas_height,
207
+ source_width, source_height) {
208
+ const cache = this.frozeFrameCache;
209
+
210
+ const index = this.stopFrame === "start" ? 0 : frame_info_list.length - 1;
211
+ const tr = _getTransformInfo(
212
+ frame_info_list[index].source,
213
+ frame_info_list[index].target,
214
+ canvas_width,
215
+ canvas_height
216
+ );
276
217
 
277
- let tr_str = "";
278
- tr_str = `${tr_str}transform:${clip_trans};transform-origin:left top;`;
279
- clip_keyframs += tr_str;
218
+ cache.clipStyle = {
219
+ transform: _createTransformStyle(tr.csw, tr.csh, tr.cx, tr.cy),
220
+ transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
221
+ overflow: "hidden",
222
+ left: 0,
223
+ top: 0,
224
+ width: canvas_width,
225
+ height: canvas_height,
226
+ };
280
227
 
281
- tr_str = "";
282
- tr_str = `${tr_str}transform:${image_trans};transform-origin:left top;`;
283
- image_keyframs += tr_str;
228
+ cache.transStyle = {
229
+ transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
230
+ transform: _createTransformStyle(tr.sw, tr.sh, tr.x, tr.y),
231
+ width: source_width,
232
+ height: source_height,
233
+ };
234
+
235
+ cache.imageStyle = {
236
+ backgroundImage: image_url,
237
+ width: source_width,
238
+ height: source_height,
239
+ };
240
+ },
241
+
242
+ _updateAnimateFrameCache(image_url, frame_info_list,
243
+ canvas_width, canvas_height,
244
+ source_width, source_height) {
245
+ this._clearExpiredKeyFrames();
246
+
247
+ if (!frame_info_list) { return; }
248
+ const anim_name_base = this._getAnimNameBase();
249
+ const frame_percent = 1 / (frame_info_list.length);
250
+ const anim_name_clip = `${anim_name_base}-clip`;
251
+ const anim_name_image = `${anim_name_base}-image`;
252
+ let image_keyframs = `@keyframes ${anim_name_image} {`;
253
+ let clip_keyframs = `@keyframes ${anim_name_clip} {`;
254
+
255
+ for (let i = 0; i < frame_info_list.length + 1; i++) {
256
+ let item;
257
+ if (i !== frame_info_list.length) {
258
+ item = frame_info_list[i];
259
+ } else {
260
+ // 追加一个最后一帧以保证最后一帧可见
261
+ item = frame_info_list[frame_info_list.length - 1];
262
+ }
263
+
264
+ // Header
265
+ let header;
266
+ if (i !== frame_info_list.length) {
267
+ header = `${parseFloat(frame_percent * i * 100).toFixed(2)}% {`;
268
+ } else {
269
+ header = '100% {';
270
+ }
271
+ image_keyframs += header;
272
+ clip_keyframs += header;
273
+
274
+ if (item.source) {
275
+ const tr = _getTransformInfo(item.source, item.target, canvas_width, canvas_height);
276
+ const clip_trans = _createTransformStyle(tr.csw, tr.csh, tr.cx, tr.cy);
277
+ const image_trans = _createTransformStyle(tr.sw, tr.sh, tr.x, tr.y);
278
+
279
+ let tr_str = "";
280
+ tr_str = `${tr_str}transform:${clip_trans};transform-origin:left top;`;
281
+ clip_keyframs += tr_str;
282
+
283
+ tr_str = "";
284
+ tr_str = `${tr_str}transform:${image_trans};transform-origin:left top;`;
285
+ image_keyframs += tr_str;
286
+ }
287
+
288
+ image_keyframs += '}';
289
+ clip_keyframs += '}';
284
290
  }
285
291
 
286
292
  image_keyframs += '}';
287
293
  clip_keyframs += '}';
288
- }
289
294
 
290
- image_keyframs += '}';
291
- clip_keyframs += '}';
295
+ if (this.keyFrameStyleSheet) {
296
+ this.keyFrameStyleSheet.insertRule(image_keyframs);
297
+ this.keyFrameStyleSheet.insertRule(clip_keyframs);
292
298
 
293
- if (this.keyFrameStyleSheet) {
294
- this.keyFrameStyleSheet.insertRule(image_keyframs);
295
- this.keyFrameStyleSheet.insertRule(clip_keyframs);
299
+ // 记录Keyframe设置,以便于界面关闭时进行清理
300
+ this.keyFrameNames.clip = anim_name_clip;
301
+ this.keyFrameNames.image = anim_name_image;
302
+ this.keyFrameNames.valid = true;
303
+ }
304
+ const cache = this.animateFrameCache;
305
+
306
+ cache.clipAnimName = `${anim_name_base}-clip`;
307
+ cache.imageAnimName = `${anim_name_base}-image`;
308
+
309
+ cache.clipStyle = {
310
+ overflow: "hidden",
311
+ width: canvas_width,
312
+ height: canvas_height,
313
+ transform: null, // 重置 transform,以免影响keyframe动画
314
+ transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
315
+ animation: null, // 外部设置,需要时间和loop信息
316
+ };
296
317
 
297
- // 记录Keyframe设置,以便于界面关闭时进行清理
298
- this.keyFrameNames.clip = anim_name_clip;
299
- this.keyFrameNames.image = anim_name_image;
300
- this.keyFrameNames.valid = true;
301
- }
302
- const cache = this.animateFrameCache;
303
-
304
- cache.clipAnimName = `${anim_name_base}-clip`;
305
- cache.imageAnimName = `${anim_name_base}-image`;
306
-
307
- cache.clipStyle = {
308
- overflow: "hidden",
309
- width: canvas_width,
310
- height: canvas_height,
311
- transform: null, // 重置 transform,以免影响keyframe动画
312
- transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
313
- animation: null, // 外部设置,需要时间和loop信息
314
- };
318
+ cache.transStyle = {
319
+ transform: null, // 重置 transform,以免影响keyframe动画
320
+ transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
321
+ animation: null, // 外部设置,需要时间和loop信息
322
+ width: source_width,
323
+ height: source_height,
324
+ };
315
325
 
316
- cache.transStyle = {
317
- transform: null, // 重置 transform,以免影响keyframe动画
318
- transformOrigin: this.TRANSFORM_ORIGIN_LEFT_TOP,
319
- animation: null, // 外部设置,需要时间和loop信息
320
- width: source_width,
321
- height: source_height,
322
- };
326
+ cache.imageStyle = {
327
+ backgroundImage: image_url,
328
+ width: source_width,
329
+ height: source_height,
330
+ };
331
+ },
323
332
 
324
- cache.imageStyle = {
325
- backgroundImage: image_url,
326
- width: source_width,
327
- height: source_height,
328
- };
329
- }
333
+ _clearExpiredKeyFrames() {
334
+ if (this.keyFrameNames.valid) {
335
+ this._removeKeyFrame([this.keyFrameNames.clip, this.keyFrameNames.image]);
336
+ this.keyFrameNames.valid = false;
337
+ }
338
+ },
330
339
 
331
- _clearExpiredKeyFrames() {
332
- if (this.keyFrameNames.valid) {
333
- this._removeKeyFrame([this.keyFrameNames.clip, this.keyFrameNames.image]);
334
- this.keyFrameNames.valid = false;
335
- }
336
- }
340
+ _removeKeyFrame(names_array) {
341
+ if (this.keyFrameStyleSheet) {
342
+ this.keyFrameStyleSheet.removeMultiRules(names_array);
343
+ }
344
+ },
345
+
346
+ _IsAutoStart() {
347
+ let autoStart = false;
348
+ if (typeof this.$props.autostart === "boolean") {
349
+ autoStart = this.$props.autostart;
350
+ } if (typeof this.$props.autostart === "string" && this.$props.autostart !== "none") {
351
+ autoStart = true;
352
+ }
353
+ return autoStart;
354
+ },
355
+
356
+ _AnalyzeProp() {
357
+ const used = this.$props.controller && this.$props.controller.Used;
358
+ if (this.$props.spriteInfo.frames.length === 1 || (!used && !this._IsAutoStart()) || this.stopped) {
359
+ // 单图模式
360
+ // 解析图片信息
361
+ this._updateFrozeFrameCache(
362
+ this.$props.imageUrl,
363
+ this.$props.spriteInfo.frames,
364
+ this.$props.viewSize.w,
365
+ this.$props.viewSize.h,
366
+ this.$props.spriteInfo.meta.size.w,
367
+ this.$props.spriteInfo.meta.size.h
368
+ );
369
+
370
+ return {
371
+ clipStyle: this.frozeFrameCache.clipStyle,
372
+ transStyle: this.frozeFrameCache.transStyle,
373
+ imageStyle: this.frozeFrameCache.imageStyle,
374
+ };
375
+ }
337
376
 
338
- _removeKeyFrame(names_array) {
339
- if (this.keyFrameStyleSheet) {
340
- this.keyFrameStyleSheet.removeMultiRules(names_array);
341
- }
342
- }
343
377
 
344
- _IsAutoStart() {
345
- let autoStart = false;
346
- if (typeof this.$props.autostart === "boolean") {
347
- autoStart = this.$props.autostart;
348
- } if (typeof this.$props.autostart === "string" && this.$props.autostart !== "none") {
349
- autoStart = true;
350
- }
351
- return autoStart;
352
- }
378
+ // 动画模式
379
+ if (this.animateFrameCache.imageStyle.backgroundImage !== this.$props.imageUrl) {
380
+ // 解析图片信息
381
+ this._updateAnimateFrameCache(
382
+ this.$props.imageUrl,
383
+ this.$props.spriteInfo.frames,
384
+ this.$props.viewSize.w,
385
+ this.$props.viewSize.h,
386
+ this.$props.spriteInfo.meta.size.w,
387
+ this.$props.spriteInfo.meta.size.h
388
+ );
389
+ }
353
390
 
354
- _AnalyzeProp() {
355
- const used = this.$props.controller && this.$props.controller.Used;
356
- if (this.$props.spriteInfo.frames.length === 1 || (!used && !this._IsAutoStart()) || this.stopped) {
357
- // 单图模式
358
- // 解析图片信息
359
- this._updateFrozeFrameCache(
360
- this.$props.imageUrl,
361
- this.$props.spriteInfo.frames,
362
- this.$props.viewSize.w,
363
- this.$props.viewSize.h,
364
- this.$props.spriteInfo.meta.size.w,
365
- this.$props.spriteInfo.meta.size.h
366
- );
391
+ // 使用duration和loop信息更新动画设定
392
+ this.animateFrameCache.clipStyle.animation =
393
+ `${this.animateFrameCache.clipAnimName} ${this.spriteDuration}s steps(1,end) ${this.$props.loop}`;
394
+ this.animateFrameCache.transStyle.animation =
395
+ `${this.animateFrameCache.imageAnimName} ${this.spriteDuration}s steps(1,end) ${this.$props.loop}`;
367
396
 
368
397
  return {
369
- clipStyle: this.frozeFrameCache.clipStyle,
370
- transStyle: this.frozeFrameCache.transStyle,
371
- imageStyle: this.frozeFrameCache.imageStyle,
398
+ clipStyle: this.animateFrameCache.clipStyle,
399
+ transStyle: this.animateFrameCache.transStyle,
400
+ imageStyle: this.animateFrameCache.imageStyle,
372
401
  };
373
- }
374
-
375
-
376
- // 动画模式
377
- if (this.animateFrameCache.imageStyle.backgroundImage !== this.$props.imageUrl) {
378
- // 解析图片信息
379
- this._updateAnimateFrameCache(
380
- this.$props.imageUrl,
381
- this.$props.spriteInfo.frames,
382
- this.$props.viewSize.w,
383
- this.$props.viewSize.h,
384
- this.$props.spriteInfo.meta.size.w,
385
- this.$props.spriteInfo.meta.size.h
386
- );
387
- }
388
-
389
- // 使用duration和loop信息更新动画设定
390
- this.animateFrameCache.clipStyle.animation =
391
- `${this.animateFrameCache.clipAnimName} ${this.spriteDuration}s steps(1,end) ${this.$props.loop}`;
392
- this.animateFrameCache.transStyle.animation =
393
- `${this.animateFrameCache.imageAnimName} ${this.spriteDuration}s steps(1,end) ${this.$props.loop}`;
394
-
395
- return {
396
- clipStyle: this.animateFrameCache.clipStyle,
397
- transStyle: this.animateFrameCache.transStyle,
398
- imageStyle: this.animateFrameCache.imageStyle,
399
- };
400
- }
402
+ },
403
+
404
+ // shouldComponentUpdate(next_props, next_state) {
405
+ // return (
406
+ // (this.$props.imageUrl !== next_props.imageUrl)
407
+ // || (this.$props.onAnimEnd !== next_props.onAnimEnd)
408
+ // || (this.$props.loop !== next_props.loop)
409
+ // || (this.spriteDuration !== next_state.duration)
410
+ // || (this.$props.autostart !== next_props.autostart)
411
+ // || this.innerId !== next_state.innerId
412
+ // || this.stopped !== next_state.stopped
413
+ // || this.blinkAnim !== next_state.blinkAnim
414
+ // );
415
+ // }
416
+
417
+ onAnimEndDelegate() {
418
+ // 在onAnimEnd之前进行Stop,以防onAnimEnd内部继续发生别的操作
419
+ this.stopped = true;
420
+ if (this.$props.onAnimEnd) {
421
+ this.$props.onAnimEnd();
422
+ }
423
+ },
401
424
 
402
- // shouldComponentUpdate(next_props, next_state) {
403
- // return (
404
- // (this.$props.imageUrl !== next_props.imageUrl)
405
- // || (this.$props.onAnimEnd !== next_props.onAnimEnd)
406
- // || (this.$props.loop !== next_props.loop)
407
- // || (this.spriteDuration !== next_state.duration)
408
- // || (this.$props.autostart !== next_props.autostart)
409
- // || this.innerId !== next_state.innerId
410
- // || this.stopped !== next_state.stopped
411
- // || this.blinkAnim !== next_state.blinkAnim
412
- // );
413
- // }
414
-
415
- onAnimEndDelegate() {
416
- // 在onAnimEnd之前进行Stop,以防onAnimEnd内部继续发生别的操作
417
- this.stopped = true;
418
- if (this.$props.onAnimEnd) {
419
- this.$props.onAnimEnd();
425
+ onBlinkAnimEnd() {
426
+ // 在onAnimEnd之前进行Stop,以防onAnimEnd内部继续发生别的操作
427
+ this.blinkAnim = null;
420
428
  }
421
429
  }
422
-
423
- onBlinkAnimEnd() {
424
- // 在onAnimEnd之前进行Stop,以防onAnimEnd内部继续发生别的操作
425
- this.blinkAnim = null;
426
- }
427
-
428
- unmounted() {
429
- this._clearExpiredKeyFrames();
430
- }
431
-
432
430
  }
433
- export default JsvSpriteAnim;
434
431
  </script>
435
432
 
436
433
  <template>
@@ -34,6 +34,7 @@ import { Forge } from "../../../dom/jsv-forge-define";
34
34
  import JsvActorMove, {
35
35
  JsvActorMoveControl,
36
36
  } from "jsview/utils/JsViewVueWidget/JsvActorMove";
37
+ import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
37
38
  import Indicator from "./Indicator.vue";
38
39
  import { ref } from "vue";
39
40
 
@@ -50,7 +51,7 @@ function modToRange(value, mod, start = 0) {
50
51
  }
51
52
 
52
53
  export default {
53
- components: { Indicator, JsvActorMove },
54
+ components: { Indicator, JsvActorMove, JsvVisibleSensor },
54
55
  props: {
55
56
  showIndicator: {
56
57
  type: Boolean,
@@ -127,7 +128,7 @@ export default {
127
128
  reverseSwipe: {
128
129
  type: Boolean,
129
130
  default: false,
130
- }
131
+ },
131
132
  },
132
133
  computed: {
133
134
  indicatorLayout() {
@@ -407,6 +408,13 @@ export default {
407
408
  this.offset += direction;
408
409
  this._startAnimation(direction > 0 ? 1 : -1);
409
410
  },
411
+ onBeVisible(old_h, new_h, old_v, new_v) {
412
+ if ((old_h && !new_h) || (old_v && !new_h)) {
413
+ this.stopAutoplay();
414
+ } else if ((!old_h && new_h) || (!old_v && new_h)) {
415
+ this.startAutoplay();
416
+ }
417
+ },
410
418
  },
411
419
  mounted() {
412
420
  if (!this.focused) {
@@ -420,6 +428,14 @@ export default {
420
428
  </script>
421
429
 
422
430
  <template>
431
+ <jsv-visible-sensor
432
+ :horizonShown="0.2"
433
+ :verticalShown="0.2"
434
+ :width="layoutInfo.width"
435
+ :height="layoutInfo.height"
436
+ :enable="true"
437
+ :callback="onBeVisible"
438
+ ></jsv-visible-sensor>
423
439
  <jsv-focus-block
424
440
  :name="name"
425
441
  :onAction="{