@shijiu/jsview-vue 2.1.6-alpha.0 → 2.1.23

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 (31) hide show
  1. package/package.json +1 -1
  2. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +22 -1
  3. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +6 -0
  4. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +24 -15
  5. package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +3 -3
  6. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
  7. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +1847 -0
  8. package/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.js +101 -0
  9. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +369 -0
  10. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-0.9.vue +53 -0
  11. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +505 -0
  12. package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +60 -0
  13. package/utils/JsViewPlugin/JsvPlayer/index.js +59 -0
  14. package/utils/JsViewPlugin/JsvPlayer/version.mjs +18 -0
  15. package/utils/JsViewPlugin/index.js +1 -0
  16. package/utils/JsViewVueTools/JsvRuntimeBridge.js +5 -4
  17. package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.js +112 -0
  18. package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.js +68 -0
  19. package/utils/JsViewVueWidget/JsvFreeMoveActor/CommonTools.js +18 -0
  20. package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +46 -0
  21. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.js +216 -0
  22. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.js +66 -0
  23. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.js +38 -0
  24. package/utils/JsViewVueWidget/JsvFreeMoveActor/TypeDefine.js +12 -0
  25. package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +3 -0
  26. package/utils/JsViewVueWidget/JsvPosterImage.vue +16 -10
  27. package/utils/JsViewVueWidget/JsvRipple/Constant.js +4 -0
  28. package/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue +134 -0
  29. package/utils/JsViewVueWidget/JsvRipple/index.js +7 -0
  30. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +55 -68
  31. package/utils/JsViewVueWidget/index.js +2 -0
@@ -0,0 +1,134 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * JsvRipple: 波纹组件
4
+ * 组件说明:
5
+ * 只在盒子端支持, 浏览器端无效果
6
+ * 出于性能考虑, 最多同时有5个波纹
7
+ * 波的函数为 f(x, t) = amplitude * exp(-timeDecay * t) * (1.0 / (1.0 + distanceDecay * x * x))
8
+ * sin(PI_2 * frequency * (x / speed - t))
9
+ * props说明:
10
+ * width {int} 宽
11
+ * height {int} 高
12
+ * left {int} left位置
13
+ * top {int} top位置
14
+ * enable {boolean} 是否启用特效
15
+ * method说明:
16
+ * addSource {(x, y, amplitude, shapeParams, mediumParams) => number}
17
+ * 返回值: token
18
+ * 参数:
19
+ * x {int}: 波纹中心x坐标
20
+ * y {int}: 波纹中心y坐标
21
+ * amplitude {int}: 波幅
22
+ * shapeParams {{type: number, width?: number, height?: number, radius?: number}}:
23
+ * type: 波纹类型, 目前只有两种
24
+ * JsvRippleShape.CIRCLE 圆形波
25
+ * JsvRippleShape.RECTANGLE 圆角矩形波
26
+ * width: JsvRippleShape.RECTANGLE 时设置, 矩形的宽
27
+ * height: JsvRippleShape.RECTANGLE 时设置, 矩形的高
28
+ * radius: JsvRippleShape.RECTANGLE 时设置, 圆角半径
29
+ * mediumParams {{timeDecay: number, distanceDecay: nubmer, speed: number, frequency: number, waveNum: number}}:
30
+ * timeDecay: 时间衰减因子, 在公式中的影响为 exp(-timeDecay * t), 一般认为amplitude * exp(-timeDecay * t) < 1 时波消失, 所以要控制波的时长可以计算 ln(amplitude) / timeDecay
31
+ * distanceDecay: 距离衰减因子, 公式中的影响为 (1.0 / (1.0 + distanceDecay * x * x))
32
+ * speed: 波速 px/s
33
+ * frequency: 频率 次/s
34
+ * waveNum: 波的个数
35
+ * removeSource {(token) => void}
36
+ * 参数:
37
+ * token: 波源的token
38
+ -->
39
+ <script setup>
40
+ import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
41
+ import { onBeforeUnmount, watchEffect } from "vue";
42
+ import { JsvRippleShape } from "./Constant";
43
+
44
+ const props = defineProps({
45
+ width: {
46
+ type: Number,
47
+ },
48
+ height: {
49
+ type: Number,
50
+ },
51
+ left: {
52
+ type: Number,
53
+ default: 0,
54
+ },
55
+ top: {
56
+ type: Number,
57
+ default: 0,
58
+ },
59
+ enable: {
60
+ type: Boolean,
61
+ default: true,
62
+ },
63
+ });
64
+ const TAG = "JsvRipple";
65
+
66
+ let filterView = new Forge.FilterView(null, Forge.FilterView.Type.WAVE);
67
+ let viewId = Forge.sViewStore.add(new Forge.ViewInfo(filterView, null));
68
+
69
+ // 监控filter改变
70
+ watchEffect(() => {
71
+ if (filterView) {
72
+ filterView.FilterSwitch(!!props.enable);
73
+ }
74
+ });
75
+
76
+ onBeforeUnmount(() => {
77
+ if (viewId > 0) {
78
+ Forge.sViewStore.remove(viewId);
79
+ viewId = -1;
80
+ }
81
+ });
82
+
83
+ const defaultMediumParams = {
84
+ timeDecay: 3,
85
+ distanceDecay: 8,
86
+ speed: 100,
87
+ frequency: 8,
88
+ waveNum: 2,
89
+ };
90
+ const addSource = (
91
+ x,
92
+ y,
93
+ amplitude,
94
+ shapeParams = {
95
+ type: JsvRippleShape.CIRCLE,
96
+ },
97
+ mediumParams = {}
98
+ ) => {
99
+ if (filterView) {
100
+ const defObj = Object.assign({}, defaultMediumParams);
101
+ const m = Object.assign(defObj, mediumParams);
102
+ return filterView.AddWaveSourceSingle(x, y, amplitude, shapeParams, m);
103
+ } else {
104
+ console.warn(TAG, "addSource while filterView is null.");
105
+ }
106
+ };
107
+
108
+ const removeSource = (id) => {
109
+ if (filterView) {
110
+ filterView.RemoveSource(id);
111
+ } else {
112
+ console.warn(TAG, "removeSource while filterView is null");
113
+ }
114
+ };
115
+
116
+ defineExpose({
117
+ addSource,
118
+ removeSource,
119
+ });
120
+ </script>
121
+
122
+ <template>
123
+ <div
124
+ :style="{
125
+ left: left,
126
+ top: top,
127
+ width: width,
128
+ height: height,
129
+ }"
130
+ :data-jsv-vw-innerview="viewId"
131
+ >
132
+ <slot></slot>
133
+ </div>
134
+ </template>
@@ -0,0 +1,7 @@
1
+ import JsvRipple from "./JsvRipple.vue";
2
+ import { JsvRippleShape } from "./Constant";
3
+
4
+ export {
5
+ JsvRipple as default,
6
+ JsvRippleShape
7
+ }
@@ -307,16 +307,16 @@ export default {
307
307
  }, this.autoplayInterval);
308
308
  }
309
309
  },
310
- slideTo(id, direction) {
310
+ slideTo(id, direction = 0) {
311
311
  const curId = modToRange(this.firstFrame + this.offset, this.totalFrame);
312
312
  if (curId != id) {
313
- if (direction > 0) {
314
- this._trigger(modToRange(id - curId, this.totalFrame));
313
+ let d;
314
+ if (direction != 0) {
315
+ d = direction
315
316
  } else {
316
- this._trigger(
317
- modToRange(id - curId, this.totalFrame, -this.totalFrame + 1)
318
- );
317
+ d = id - curId;
319
318
  }
319
+ this._trigger(modToRange(id - curId, this.totalFrame, d > 0 ? 0 : -this.totalFrame + 1));
320
320
  }
321
321
  },
322
322
  _onKeyDown(ev) {
@@ -388,7 +388,7 @@ export default {
388
388
  this.startAutoplay();
389
389
  this.onBlur?.();
390
390
  },
391
- _startNormalAnimation(direction) {
391
+ _startAnimation(direction, smooth = false) {
392
392
  let duration = this.animation.duration;
393
393
  // let easing = this.animation.easing ? this.animation.easing : "linear";
394
394
 
@@ -396,22 +396,52 @@ export default {
396
396
  let preViewAnimation;
397
397
  switch (this.swipeType) {
398
398
  case "translate":
399
- curViewAnimation = new Forge.TranslateAnimation(
400
- this.vertical ? 0 : direction * this.layoutInfo.width,
401
- 0,
402
- this.vertical ? direction * this.layoutInfo.height : 0,
403
- 0,
404
- duration,
405
- null
406
- );
407
- preViewAnimation = new Forge.TranslateAnimation(
408
- this.vertical ? 0 : direction * this.layoutInfo.width,
409
- 0,
410
- this.vertical ? direction * this.layoutInfo.height : 0,
411
- 0,
412
- duration,
413
- null
414
- );
399
+ if (smooth) {
400
+ const speed =
401
+ ((this.vertical
402
+ ? this.layoutInfo.height
403
+ : this.layoutInfo.width) /
404
+ this.animation.duration) *
405
+ 1000;
406
+ curViewAnimation = new Forge.TranslateFrameAnimation(
407
+ this.vertical
408
+ ? direction * this.layoutInfo.height
409
+ : direction * this.layoutInfo.width,
410
+ 0,
411
+ speed,
412
+ !this.vertical,
413
+ this.vertical ? 0 : direction * this.layoutInfo.width,
414
+ this.vertical ? direction * this.layoutInfo.height : 0
415
+ );
416
+
417
+ preViewAnimation = new Forge.TranslateFrameAnimation(
418
+ this.vertical
419
+ ? direction * this.layoutInfo.height
420
+ : direction * this.layoutInfo.width,
421
+ 0,
422
+ speed,
423
+ !this.vertical,
424
+ this.vertical ? 0 : direction * this.layoutInfo.width,
425
+ this.vertical ? direction * this.layoutInfo.height : 0
426
+ );
427
+ } else {
428
+ curViewAnimation = new Forge.TranslateAnimation(
429
+ this.vertical ? 0 : direction * this.layoutInfo.width,
430
+ 0,
431
+ this.vertical ? direction * this.layoutInfo.height : 0,
432
+ 0,
433
+ duration,
434
+ null
435
+ );
436
+ preViewAnimation = new Forge.TranslateAnimation(
437
+ this.vertical ? 0 : direction * this.layoutInfo.width,
438
+ 0,
439
+ this.vertical ? direction * this.layoutInfo.height : 0,
440
+ 0,
441
+ duration,
442
+ null
443
+ );
444
+ }
415
445
  break;
416
446
  case "opacity":
417
447
  break;
@@ -430,36 +460,11 @@ export default {
430
460
  ?.jsvGetProxyView(true)
431
461
  .StartAnimation(preViewAnimation);
432
462
  },
433
- _startSmoothTranslateAnimation() {
434
- let curController = this.controllerList[this.currentViewIndex];
435
- let preController =
436
- this.controllerList[modToRange(this.currentViewIndex - 1, VIEW_NUM)];
437
- if (this.vertical) {
438
- let speed = (this.layoutInfo.height / this.animation.duration) * 1000;
439
- curController.jumpTo(0, this.layoutInfo.height);
440
- curController.moveToY(0, speed, this._onAnimationEnd);
441
- preController.jumpTo(0, this.layoutInfo.height);
442
- preController.moveToY(0, speed);
443
- } else {
444
- let speed = (this.layoutInfo.width / this.animation.duration) * 1000;
445
- curController.jumpTo(this.layoutInfo.width, 0);
446
- curController.moveToX(0, speed, this._onAnimationEnd);
447
- preController.jumpTo(this.layoutInfo.width, 0);
448
- preController.moveToX(0, speed);
449
- }
450
- },
451
- _startAnimation(direction) {
452
- if (this.smoothTranslate) {
453
- this._startSmoothTranslateAnimation();
454
- } else {
455
- this._startNormalAnimation(direction);
456
- }
457
- },
458
463
  _trigger(direction) {
459
464
  if (this.totalFrame <= 1) return;
460
465
  this.preOffset = this.offset;
461
466
  this.offset += direction;
462
- this._startAnimation(direction > 0 ? 1 : -1);
467
+ this._startAnimation(direction > 0 ? 1 : -1, this.smoothTranslate);
463
468
  },
464
469
  onBeVisible(old_h, new_h, old_v, new_v) {
465
470
  if ((old_h && !new_h) || (old_v && !new_h)) {
@@ -526,25 +531,7 @@ export default {
526
531
  zIndex: 0,
527
532
  }"
528
533
  >
529
- <div v-if="smoothTranslate">
530
- <jsv-actor-move
531
- v-for="(item, index) in viewInfoList"
532
- :key="index"
533
- :style="item.style"
534
- :control="controllerList[index]"
535
- >
536
- <!-- 为了保证slot中的页面刷新。不加这个div slot中的img标签不会更新,vue或者是dom的bug? -->
537
- <div :key="item.dataIndex">
538
- <slot
539
- name="itemView"
540
- :currentIndex="currentDataIndex"
541
- :dataIndex="item.dataIndex"
542
- :focused="focused"
543
- ></slot>
544
- </div>
545
- </jsv-actor-move>
546
- </div>
547
- <div v-else>
534
+ <div>
548
535
  <div
549
536
  v-for="(item, index) in viewInfoList"
550
537
  :key="index"
@@ -6,6 +6,7 @@
6
6
  * @Description: file content
7
7
  */
8
8
  export { default as JsvActorMove, JsvActorMoveControl } from "./JsvActorMove";
9
+ export { default as JsvFreeMoveActor } from "./JsvFreeMoveActor";
9
10
  export { default as JsvApic, LoopType } from "./JsvApic";
10
11
  export { default as JsvInput, InputType } from "./JsvInput";
11
12
  export {
@@ -42,3 +43,4 @@ export { default as JsvTransparentDiv } from "./JsvTransparentDiv.vue";
42
43
  export { default as JsvVideo } from "./JsvVideo.vue";
43
44
  export { default as JsvSystemAudio } from "./JsvSystemAudio.vue";
44
45
  export { default as JsvRadarChart} from "./JsvRadarChart.vue";
46
+ export { default as JsvRipple, JsvRippleShape } from "./JsvRipple"