@kimap/indoor-positioning-sdk-vue2 4.2.4 → 4.2.5

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": "@kimap/indoor-positioning-sdk-vue2",
3
- "version": "4.2.4",
3
+ "version": "4.2.5",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/KMUtil.js CHANGED
@@ -560,6 +560,7 @@
560
560
  * options: { inflationCells } 障碍膨胀(格数),默认 1
561
561
  */
562
562
  function aStarPathfinding(start, end, obstacles, gridSize) {
563
+ console.log('开始规划路径', obstacles)
563
564
  gridSize = gridSize || 0.5;
564
565
 
565
566
  var openList = [];
@@ -852,19 +852,17 @@ KimapSDK.prototype._loadSingleFurniture = function(furniture, serverUrl) {
852
852
 
853
853
  // 等待loader加载完成后再加载模型
854
854
  loaderPromise.then(function(loader) {
855
- // 先验证URL是否有效
855
+ // 先验证URL是否返回HTML(只拦截HTML,允许404等错误通过)
856
856
  return fetch(modelUrl, { method: 'HEAD' })
857
857
  .then(function(response) {
858
- if (!response.ok) {
859
- throw new Error('家具模型文件不存在 (HTTP ' + response.status + '): ' + modelUrl);
860
- }
861
-
858
+ // 只检查Content-Type,不检查HTTP状态码
859
+ // 404等错误让OBJLoader自己处理
862
860
  var contentType = response.headers.get('content-type');
863
- if (contentType && contentType.includes('text/html')) {
861
+ if (response.ok && contentType && contentType.includes('text/html')) {
864
862
  throw new Error('URL返回HTML而不是3D模型文件: ' + modelUrl);
865
863
  }
866
864
 
867
- // URL验证通过,开始加载模型
865
+ // 验证通过或404等错误,继续加载(让loader处理)
868
866
  return new Promise(function(resolveLoad, rejectLoad) {
869
867
  loader.load(
870
868
  modelUrl,
@@ -407,19 +407,17 @@ SceneCore.prototype._loadOBJFile = function(url, objLoader, resolve, reject) {
407
407
 
408
408
  console.log('加载OBJ文件...', url);
409
409
 
410
- // 先验证URL是否返回正确的内容
410
+ // 先验证URL是否返回HTML(只拦截HTML,允许404等错误通过)
411
411
  fetch(url, { method: 'HEAD' })
412
412
  .then(function(response) {
413
- if (!response.ok) {
414
- throw new Error('文件不存在或无法访问 (HTTP ' + response.status + ')');
415
- }
416
-
413
+ // 只检查Content-Type,不检查HTTP状态码
414
+ // 404等错误让OBJLoader自己处理
417
415
  var contentType = response.headers.get('content-type');
418
- if (contentType && contentType.includes('text/html')) {
416
+ if (response.ok && contentType && contentType.includes('text/html')) {
419
417
  throw new Error('URL返回的是HTML页面而不是OBJ文件,请检查URL是否正确');
420
418
  }
421
419
 
422
- // URL验证通过,开始加载
420
+ // 验证通过或404等错误,继续加载(让loader处理)
423
421
  objLoader.load(
424
422
  url,
425
423
  function(object) {