@shijiu/jsview-vue 0.9.602 → 0.9.631
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/target_core_revision.js +4 -4
- package/package.json +1 -1
- package/samples/Basic/components/text/TextOverflow.vue +2 -2
- package/samples/Collision/App.vue +452 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
- package/samples/DemoHomepage/router.js +20 -0
- package/samples/DemoHomepage/views/Homepage.vue +3 -10
- package/samples/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -17
- package/samples/Input/InputPanel.vue +18 -11
- package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
- package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +2 -10
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
- package/samples/Preload/App.vue +16 -11
- package/samples/TextureAnimation/App2.vue +111 -0
- package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureAnimation/assets/mask.png +0 -0
- package/samples/VisibleSensorDemo/App.vue +92 -25
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +36 -2
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +17 -2
- package/utils/JsViewPlugin/JsvPlayer/index.js +8 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +37 -41
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +123 -46
- package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
- package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
- package/utils/JsViewVueWidget/index.js +2 -2
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* 列表的内容可以是图片,音频等任何网络资源,下载后缓存在本地,归入本地缓存管理(LRU清理策略)
|
|
8
8
|
* onPreloading {Function(float percent)}: 预加载中回调,返回预加载进度
|
|
9
9
|
* onPreloadDone {Function(sizeArray)}: 预加载完成回调,sizeArray(格式Object[]),每个的格式为{width, height}
|
|
10
|
-
* onDownloadDone {Function(pathesArray)}: 预下载完成回调,pathesArray(格式为String[])为下载好回调的地址,
|
|
11
|
-
* 其中pathesArray
|
|
10
|
+
* onDownloadDone {Function(pathesArray, extra)}: 预下载完成回调,pathesArray(格式为String[])为下载好回调的地址,
|
|
11
|
+
* 其中pathesArray为存储位置的路径列表, extra为额外信息(目前只有下载图片时的尺寸)
|
|
12
12
|
*
|
|
13
13
|
* 注意事项:
|
|
14
14
|
* 指定加载时的尺寸(0为不指定),与img标签中的 jsv_img_scaledown_tex 属性一起使用
|
|
@@ -54,10 +54,11 @@ const buildPreloadInfo = (
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const buildDownloadInfo = (url, net_setting = null) => {
|
|
57
|
+
const buildDownloadInfo = (url, net_setting = null, get_image_size) => {
|
|
58
58
|
return {
|
|
59
59
|
url,
|
|
60
60
|
netSetting: net_setting,
|
|
61
|
+
getImageSize: get_image_size,
|
|
61
62
|
magicToken: CONST_FORMAT_TOKEN, // 用于格式校验
|
|
62
63
|
};
|
|
63
64
|
};
|
|
@@ -79,6 +80,7 @@ export default {
|
|
|
79
80
|
downloadViewList: [],
|
|
80
81
|
preloadStateList: [],
|
|
81
82
|
downloadStateList: [],
|
|
83
|
+
downloadResultMap: {},
|
|
82
84
|
preloadResultMap: {},
|
|
83
85
|
CONST_FORMAT_TOKEN: "_JsvP_",
|
|
84
86
|
preloadIsNullNum: 0, // 纪录传入的preload为null的数量,由于vue不支持在子组件修改props值,所有在删除值为null时,需要++,这样才能保证与传入数据的length相等从而触发回调
|
|
@@ -136,29 +138,6 @@ export default {
|
|
|
136
138
|
}
|
|
137
139
|
},
|
|
138
140
|
|
|
139
|
-
// shouldComponentUpdate(nextProps, nextState) {
|
|
140
|
-
// if (
|
|
141
|
-
// nextProps.preloadList.length === this.preloadList.length &&
|
|
142
|
-
// nextProps.downloadList.length === this.downloadList.length
|
|
143
|
-
// ) {
|
|
144
|
-
// let same = true;
|
|
145
|
-
// for (let i = 0; i < nextProps.preloadList.length; i++) {
|
|
146
|
-
// if (nextProps.preloadList[i].url !== this.preloadList[i].url) {
|
|
147
|
-
// same = false;
|
|
148
|
-
// break;
|
|
149
|
-
// }
|
|
150
|
-
// }
|
|
151
|
-
// for (let i = 0; i < nextProps.downloadList.length; i++) {
|
|
152
|
-
// if (nextProps.downloadList[i].url !== this.downloadList[i].url) {
|
|
153
|
-
// same = false;
|
|
154
|
-
// break;
|
|
155
|
-
// }
|
|
156
|
-
// }
|
|
157
|
-
// return !same;
|
|
158
|
-
// }
|
|
159
|
-
// return true;
|
|
160
|
-
// },
|
|
161
|
-
|
|
162
141
|
_checkPreload() {
|
|
163
142
|
let loadedNum = 0;
|
|
164
143
|
this.preloadStateList.forEach((state) => {
|
|
@@ -261,7 +240,10 @@ export default {
|
|
|
261
240
|
if (!state) return;
|
|
262
241
|
}
|
|
263
242
|
if (this.$props.onDownloadDone) {
|
|
264
|
-
this.$props.onDownloadDone(
|
|
243
|
+
this.$props.onDownloadDone(
|
|
244
|
+
this.downloadStateList,
|
|
245
|
+
this.downloadResultMap
|
|
246
|
+
);
|
|
265
247
|
}
|
|
266
248
|
},
|
|
267
249
|
|
|
@@ -269,7 +251,6 @@ export default {
|
|
|
269
251
|
if (!this.downloadList) {
|
|
270
252
|
return;
|
|
271
253
|
}
|
|
272
|
-
this.downloadStateList = new Array(this.downloadList.length).fill(null);
|
|
273
254
|
// 直接在map前将url为null的值清除掉
|
|
274
255
|
let downloadListData = this.downloadList;
|
|
275
256
|
for (let i = 0; i < downloadListData.length; i++) {
|
|
@@ -277,13 +258,14 @@ export default {
|
|
|
277
258
|
downloadListData.splice(i, 1);
|
|
278
259
|
}
|
|
279
260
|
}
|
|
261
|
+
this.downloadStateList = new Array(downloadListData.length).fill(null);
|
|
280
262
|
this.downloadViewList = downloadListData.map((item, index) => {
|
|
281
263
|
if (item.magicToken !== this.CONST_FORMAT_TOKEN) {
|
|
282
264
|
console.error(
|
|
283
265
|
"Error:format mismatch, data should comes from function buildDownloadInfo()"
|
|
284
266
|
);
|
|
285
267
|
}
|
|
286
|
-
console.log(`OnDownload get${index} url=${item.url}`)
|
|
268
|
+
console.log(`OnDownload get${index} url=${item.url}`);
|
|
287
269
|
const base_url = item.url;
|
|
288
270
|
let image_url = base_url;
|
|
289
271
|
if (base_url && base_url.indexOf("http") < 0) {
|
|
@@ -292,19 +274,33 @@ export default {
|
|
|
292
274
|
image_url = new window.JsView.Dom.UrlRef(base_url).href;
|
|
293
275
|
}
|
|
294
276
|
}
|
|
295
|
-
const texture =
|
|
296
|
-
|
|
277
|
+
const texture = ForgeExtension.TextureManager.GetDownloadTexture(
|
|
278
|
+
image_url,
|
|
279
|
+
null,
|
|
280
|
+
item.getImageSize
|
|
281
|
+
);
|
|
297
282
|
if (!texture) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
283
|
+
console.error(
|
|
284
|
+
"Error: Down view build texture failed for " + image_url
|
|
285
|
+
);
|
|
286
|
+
// 无法创建texture的图片先认为加载完成
|
|
287
|
+
this.downloadStateList[index] = "invalid";
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const callback_token = texture.RegisterLoadImageCallback(
|
|
291
|
+
null,
|
|
292
|
+
(texture_info) => {
|
|
293
|
+
console.log(`OnDownload done index${index}`);
|
|
294
|
+
this.downloadStateList[index] = texture_info.extra.absolutePath;
|
|
295
|
+
if (item.getImageSize && texture_info.extra.width && texture_info.extra.height) {
|
|
296
|
+
this.downloadResultMap[texture_info.extra.absolutePath] = {
|
|
297
|
+
width: texture_info.extra.width,
|
|
298
|
+
height: texture_info.extra.height,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
this._checkDownload();
|
|
302
|
+
}
|
|
303
|
+
);
|
|
308
304
|
if (texture.EnableBackgroundLoad) {
|
|
309
305
|
texture.EnableBackgroundLoad(this);
|
|
310
306
|
}
|