@shijiu/jsview-vue 1.9.921 → 1.9.943-next-vue.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "1.9.921",
3
+ "version": "1.9.943-next-vue.0",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",
@@ -0,0 +1,13 @@
1
+ let handles = {
2
+ TextureManager: null,
3
+ RootView: null,
4
+ RootActivity: null
5
+ }
6
+
7
+ window.JsvCode.ForgeHandles.listenToReady(()=>{
8
+ handles.TextureManager = window.JsvCode.ForgeHandles.TextureManager;
9
+ handles.RootView = window.JsvCode.ForgeHandles.RootView;
10
+ handles.RootActivity = window.JsvCode.ForgeHandles.RootActivity;
11
+ })
12
+
13
+ export default handles;
@@ -20,7 +20,7 @@
20
20
  * play(): 开始播放
21
21
  -->
22
22
  <script>
23
- import { ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
23
+ import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
24
24
 
25
25
  let LOOP_DEFAULT = 0;
26
26
  let LOOP_INFINITE = 1;
@@ -69,7 +69,7 @@ export default {
69
69
  play() {
70
70
  if (this.$refs.element) {
71
71
  let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
72
- ForgeExtension.TextureManager
72
+ ForgeHandles.TextureManager
73
73
  );
74
74
 
75
75
  let params = {
@@ -93,7 +93,7 @@ export default {
93
93
  stop() {
94
94
  if (this.$refs.element) {
95
95
  let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
96
- ForgeExtension.TextureManager
96
+ ForgeHandles.TextureManager
97
97
  );
98
98
  mainViewTexture.DispatchCommand(Forge.NativeConstant.APIC_STOP, "");
99
99
  }
@@ -106,7 +106,7 @@ export default {
106
106
  if (this.onLoad) {
107
107
  if (this.$refs.element) {
108
108
  let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
109
- ForgeExtension.TextureManager
109
+ ForgeHandles.TextureManager
110
110
  );
111
111
  mainViewTexture.RegisterLoadImageCallback(null, this.onLoad, null);
112
112
  }
@@ -116,7 +116,7 @@ export default {
116
116
  this.stop();
117
117
  if (this.$refs.element) {
118
118
  let mainViewTexture = this.$refs.element.jsvGetProxyTexture(
119
- ForgeExtension.TextureManager
119
+ ForgeHandles.TextureManager
120
120
  );
121
121
 
122
122
  if (this.onStart) {
@@ -6,7 +6,7 @@
6
6
  -->
7
7
  <script>
8
8
  import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
9
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
9
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
10
10
  import CursorVue from "./Cursor.vue";
11
11
 
12
12
  const InputType = {
@@ -13,6 +13,7 @@
13
13
  -->
14
14
  <script>
15
15
  import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
16
+ import ForgeHandles from "../JsViewVueTools/ForgeHandles";
16
17
  export default {
17
18
  props: {
18
19
  class: {
@@ -8,7 +8,8 @@
8
8
  -->
9
9
 
10
10
  <script>
11
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
11
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
12
+ import ForgeHandles from "../JsViewVueTools/ForgeHandles";
12
13
 
13
14
  export default {
14
15
  props: {
@@ -44,7 +45,7 @@ export default {
44
45
  let textureSetting = null;
45
46
  if (this.seeThrough) {
46
47
  const seeThroughTexture =
47
- ForgeExtension.TextureManager.GetColorTexture("rgba(0,0,0,0)");
48
+ ForgeHandles.TextureManager.GetColorTexture("rgba(0,0,0,0)");
48
49
  textureSetting = new Forge.TextureSetting(
49
50
  seeThroughTexture,
50
51
  null,
@@ -55,7 +56,7 @@ export default {
55
56
 
56
57
  // 通过内置函数构造定制的NativeSharedView
57
58
  this.jsvMainView = new Forge.NativeSharedView(textureSetting);
58
- this.innerViewId = ForgeExtension.RootActivity.ViewStore.add(
59
+ this.innerViewId = ForgeHandles.RootActivity.ViewStore.add(
59
60
  new Forge.ViewInfo(this.jsvMainView)
60
61
  );
61
62
 
@@ -76,7 +77,7 @@ export default {
76
77
 
77
78
  // 清理View管理缓存
78
79
  if (this.innerViewId !== -1) {
79
- ForgeExtension.RootActivity.ViewStore.remove(this.innerViewId);
80
+ ForgeHandles.RootActivity.ViewStore.remove(this.innerViewId);
80
81
  this.innerViewId = -1;
81
82
  this.jsvMainView = null;
82
83
  }
@@ -16,64 +16,77 @@
16
16
  * waitForInit {boolean} (选填)尺寸为0时是否进行描画(例如: 首次显示不展示动画的场合,设置为true),默认值为true
17
17
  -->
18
18
 
19
- <script>
20
- export default {
21
- name: "JsvNinePatch",
22
- props: {
23
- style: {
24
- type: Object,
25
- default: () => {
26
- return {};
27
- },
28
- },
29
- top: { type: Number, default: 0 },
30
- left: { type: Number, default: 0 },
31
- waitForInit: { type: Boolean, default: true },
32
-
33
- imageUrl: { type:String, required: true },
34
- imageWidth: { type:Number, required: true },
35
- imageDspWidth: { type:Number, default:0 },
36
- contentWidth: { type:Number, default: -1},
37
- centerWidth: { type:Number, default: -1, required: true },
38
- borderOutset: { type:Number, required: true },
39
- animTime: Number,
40
- },
19
+ <script setup>
20
+ import { ref, watchEffect, computed } from "vue";
41
21
 
42
- methods: {
43
- isReady() {
44
- if (!this.waitForInit) {
45
- return true;
46
- }
47
- return this.style && this.style.width !== 0 && this.style.height !== 0;
48
- },
49
- getTransition() {
50
- let transition = "";
51
- if (this.animTime) {
52
- transition = `left ${this.animTime}s, top ${this.animTime}s, width ${this.animTime}s, height ${this.animTime}s`;
53
- }
54
-
55
- return transition;
22
+ const props = defineProps({
23
+ style: {
24
+ type: Object,
25
+ default: () => {
26
+ return {};
56
27
  },
57
28
  },
29
+ top: { type: Number, default: 0 },
30
+ left: { type: Number, default: 0 },
31
+ waitForInit: { type: Boolean, default: true },
58
32
 
59
- data() {
60
- let center_width = (this.contentWidth >= 0 ? this.contentWidth : 0); // 兼容处理,contentWidth变更为centerWidth
61
- if (this.centerWidth >= 0) {
62
- center_width = this.centerWidth;
63
- }
33
+ imageUrl: { type: String, required: true },
34
+ imageWidth: { type: Number, required: true },
35
+ imageDspWidth: { type: Number, default: 0 },
36
+ contentWidth: { type: Number, default: -1 },
37
+ centerWidth: { type: Number, default: -1, required: true },
38
+ borderOutset: { type: Number, required: true },
39
+ animTime: { type: Number, default: 0 },
40
+ });
64
41
 
65
- // slice_width 获取
66
- let slice_width = Math.ceil(Math.max(0, (this.imageWidth - center_width) / 2));
42
+ const isReady = () => {
43
+ if (!props.waitForInit) {
44
+ return true;
45
+ }
46
+ return props.style && props.style.width !== 0 && props.style.height !== 0;
47
+ };
67
48
 
68
- let image_dsp_width = this.imageDspWidth > 0 ? this.imageDspWidth : this.imageWidth;
49
+ const getTransition = () => {
50
+ let transition = "";
51
+ if (props.animTime && props.animTime > 0) {
52
+ transition = `left ${props.animTime}s, top ${props.animTime}s, width ${props.animTime}s, height ${props.animTime}s`;
53
+ }
69
54
 
70
- return {
71
- sliceWidth: slice_width,
72
- borderDspWidth: Math.ceil(slice_width * image_dsp_width / this.imageWidth), // 跟进图片的缩放信息
73
- convertedBorderOutset: Math.ceil(this.borderOutset * image_dsp_width / this.imageWidth),
74
- };
75
- },
55
+ return transition;
76
56
  };
57
+
58
+ let centerWidth = props.contentWidth >= 0 ? props.contentWidth : 0; // 兼容处理,contentWidth变更为centerWidth
59
+ if (props.centerWidth >= 0) {
60
+ centerWidth = props.centerWidth;
61
+ }
62
+
63
+ const imageDspWidthInner = computed(() =>
64
+ props.imageDspWidth > 0 ? props.imageDspWidth : props.imageWidth
65
+ );
66
+ // slice_width 获取
67
+ const sliceWidth = ref(
68
+ Math.ceil(Math.max(0, (props.imageWidth - centerWidth) / 2))
69
+ );
70
+ const borderDspWidth = ref(
71
+ Math.ceil((sliceWidth.value * imageDspWidthInner.value) / props.imageWidth)
72
+ );
73
+ const convertedBorderOutset = ref(
74
+ Math.ceil((props.borderOutset * imageDspWidthInner.value) / props.imageWidth)
75
+ );
76
+
77
+ watchEffect(() => {
78
+ if (
79
+ (props.style?.width && props.style.width <= imageDspWidthInner.value) ||
80
+ (props.style?.height && props.style.height <= imageDspWidthInner.value)
81
+ ) {
82
+ console.warn(
83
+ "JsvNinePatch: style size must be larger than imageDspWidth. style is",
84
+ props.style,
85
+ "imageDspWidth is",
86
+ imageDspWidthInner.value
87
+ );
88
+ }
89
+ });
77
90
  </script>
78
91
 
79
92
  <template>
@@ -88,6 +101,3 @@ export default {
88
101
  }"
89
102
  />
90
103
  </template>
91
-
92
- <style scoped>
93
- </style>
@@ -34,7 +34,8 @@
34
34
  * net_setting {object}: (未实现)网络加载参数,cookie, refer等,默认值 null
35
35
  -->
36
36
  <script>
37
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
37
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
38
+ import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
38
39
 
39
40
  const CONST_FORMAT_TOKEN = "_JsvP_";
40
41
  const buildPreloadInfo = (
@@ -191,9 +192,9 @@ export default {
191
192
  (image_url.toLowerCase().indexOf(".webp") >= 0 ||
192
193
  image_url.toLowerCase().indexOf(".gif") >= 0)
193
194
  ) {
194
- texture = ForgeExtension.TextureManager.GetGifImage(image_url, false);
195
+ texture = ForgeHandles.TextureManager.GetGifImage(image_url, false);
195
196
  } else {
196
- texture = ForgeExtension.TextureManager.GetImage2(
197
+ texture = ForgeHandles.TextureManager.GetImage2(
197
198
  image_url,
198
199
  false,
199
200
  target_size,
@@ -274,7 +275,7 @@ export default {
274
275
  image_url = new window.JsView.Dom.UrlRef(base_url).href;
275
276
  }
276
277
  }
277
- const texture = ForgeExtension.TextureManager.GetDownloadTexture(
278
+ const texture = ForgeHandles.TextureManager.GetDownloadTexture(
278
279
  image_url,
279
280
  null,
280
281
  item.getImageSize
@@ -16,7 +16,8 @@
16
16
  */
17
17
  -->
18
18
  <script>
19
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
19
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
20
+ import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
20
21
 
21
22
  export default {
22
23
  props: {
@@ -57,7 +58,7 @@ export default {
57
58
 
58
59
  let view = null;
59
60
  let lp_params = null;
60
- const texture_manager = ForgeExtension.TextureManager;
61
+ const texture_manager = ForgeHandles.TextureManager;
61
62
  const qrcode_texture = texture_manager.GetQRCodeTexture(
62
63
  this.value,
63
64
  this.size,
@@ -29,15 +29,20 @@
29
29
  * addNumSpeed {float} 持续喷射时,起始粒子添加速度(个/ms), 默认为0.001
30
30
  * enableFade {boolean} 粒子淡出开关, 默认为false
31
31
  * enableShrink {boolean} 粒子缩小开关, 默认为false
32
+ * angularVelocityMin {float} 角速度最小值, 默认为0
33
+ * angularVelocityMax {float} 角速度最大值, 默认为0
34
+ * alphaMin {float} 透明度最小值, 默认为1
35
+ * alphaMax {float} 透明度最大值, 默认为1
32
36
  -->
33
37
  <script>
34
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
38
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
39
+ import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
35
40
 
36
41
  let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
37
42
  if (!pointRes) {
38
43
  return -1;
39
44
  }
40
- const texture_manager = ForgeExtension.TextureManager;
45
+ const texture_manager = ForgeHandles.TextureManager;
41
46
  let texture_setting;
42
47
  if (pointRes.trim().startsWith("#") || pointRes.trim().startsWith("rgba")) {
43
48
  texture_setting = new Forge.TextureSetting(
@@ -65,6 +70,24 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
65
70
  typeof sprayStyle.accelerateY !== "undefined"
66
71
  ? sprayStyle.accelerateY
67
72
  : -100;
73
+ let angularVelocityMin = 0,
74
+ angularVelocityMax = 0;
75
+ if (
76
+ typeof sprayStyle.angularVelocityMin === "number" &&
77
+ typeof sprayStyle.angularVelocityMax === "number"
78
+ ) {
79
+ angularVelocityMin = sprayStyle.angularVelocityMin;
80
+ angularVelocityMax = sprayStyle.angularVelocityMax;
81
+ }
82
+ let alphaMin = 1,
83
+ alphaMax = 1;
84
+ if (
85
+ typeof sprayStyle.alphaMin === "number" &&
86
+ typeof sprayStyle.alphaMax === "number"
87
+ ) {
88
+ alphaMin = sprayStyle.alphaMin;
89
+ alphaMax = sprayStyle.alphaMax;
90
+ }
68
91
  spray_view.SetSprayInfo(
69
92
  sprayStyle.type,
70
93
  sprayStyle.particleNum,
@@ -82,7 +105,11 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
82
105
  accelerate_y,
83
106
  sprayStyle.enableFade,
84
107
  sprayStyle.enableShrink,
85
- ignoreClip
108
+ ignoreClip,
109
+ angularVelocityMin,
110
+ angularVelocityMax,
111
+ alphaMin,
112
+ alphaMax
86
113
  );
87
114
  const view_width =
88
115
  sprayStyle.deltaWidth === 0 ? 1 : 2 * sprayStyle.deltaWidth;
@@ -126,11 +153,21 @@ export default {
126
153
  },
127
154
  },
128
155
  created() {
129
- this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
156
+ this.viewId = buildForgeView(
157
+ this.pointRes,
158
+ this.sprayStyle,
159
+ this.size,
160
+ this.ignoreClip
161
+ );
130
162
  },
131
163
  updated() {
132
164
  this.unloadView();
133
- this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
165
+ this.viewId = buildForgeView(
166
+ this.pointRes,
167
+ this.sprayStyle,
168
+ this.size,
169
+ this.ignoreClip
170
+ );
134
171
  },
135
172
  beforeUnmount() {
136
173
  this.unloadView();
@@ -6,7 +6,8 @@
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
9
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
9
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
10
+ import ForgeHandles from "../../JsViewVueTools/ForgeHandles";
10
11
  import {
11
12
  numberCheckSet,
12
13
  urlCheckSet,
@@ -194,7 +195,7 @@ export default {
194
195
  },
195
196
 
196
197
  _createNinePatchAlphaMixView(view_texture, decorate_setting) {
197
- const textureManager = ForgeExtension.TextureManager;
198
+ const textureManager = ForgeHandles.TextureManager;
198
199
 
199
200
  // NinePatch alpha mix view
200
201
  let texture_set = new Forge.ExternalTextureSetting(view_texture);
@@ -298,7 +299,7 @@ export default {
298
299
 
299
300
  created() {
300
301
  if (window.JsView) {
301
- const textureManager = ForgeExtension.TextureManager;
302
+ const textureManager = ForgeHandles.TextureManager;
302
303
 
303
304
  // 1.获得主view的展示内容图片 texture
304
305
  let image_url = urlCheckSet(this.src);
@@ -7,7 +7,8 @@
7
7
  -->
8
8
 
9
9
  <script>
10
- import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
10
+ import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
11
+ import ForgeHandles from "../JsViewVueTools/ForgeHandles";
11
12
 
12
13
  export default {
13
14
  inheritAttrs: false,
@@ -29,8 +30,7 @@ export default {
29
30
  // 初始化View
30
31
 
31
32
  // 创建JsView图层穿透的texture,抠洞处理
32
- const seeThroughTexture =
33
- ForgeExtension.TextureManager.GetColorTexture("rgba(0,0,0,0)");
33
+ const seeThroughTexture = ForgeHandles.TextureManager.GetColorTexture("rgba(0,0,0,0)");
34
34
  const textureSetting = new Forge.TextureSetting(
35
35
  seeThroughTexture,
36
36
  null,
@@ -40,7 +40,7 @@ export default {
40
40
 
41
41
  // 通过内置函数构造定制的LayoutView
42
42
  this.innerView = new Forge.LayoutView(textureSetting);
43
- this.innerViewId = ForgeExtension.RootActivity.ViewStore.add(
43
+ this.innerViewId = ForgeHandles.RootActivity.ViewStore.add(
44
44
  new Forge.ViewInfo(this.innerView)
45
45
  );
46
46
  }
@@ -54,7 +54,7 @@ export default {
54
54
  },
55
55
  beforeUnmount() {
56
56
  if (this.innerViewId !== -1) {
57
- ForgeExtension.RootActivity.ViewStore.remove(this.innerViewId);
57
+ ForgeHandles.RootActivity.ViewStore.remove(this.innerViewId);
58
58
  this.innerViewId = -1;
59
59
  this.innerView = null;
60
60
  }