@kimap/indoor-positioning-sdk-vue2 5.7.5 → 5.7.7

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": "5.7.5",
3
+ "version": "5.7.7",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -604,8 +604,18 @@ KimapSDK.prototype.changeFloor = function(floorIdOrIndex) {
604
604
  */
605
605
  KimapSDK.prototype.showSingleFloor = function(floorIndex) {
606
606
  if (!this.floorGroups || this.floorGroups.length === 0) return;
607
+ var self = this;
607
608
  this.floorGroups.forEach(function(group, index) {
608
- group.visible = index === floorIndex;
609
+ if (index === floorIndex) {
610
+ // 单层模式:将该楼层移动到贴地位置(y = 0)
611
+ group.visible = true;
612
+ group.position.y = 0;
613
+ } else {
614
+ // 隐藏其他楼层,同时移到下方避免干扰
615
+ group.visible = false;
616
+ var originalY = self.core.floorOriginalY[index] || 0;
617
+ group.position.y = -originalY - 1; // 移到地面以下
618
+ }
609
619
  });
610
620
  };
611
621
 
@@ -615,8 +625,12 @@ KimapSDK.prototype.showSingleFloor = function(floorIndex) {
615
625
  */
616
626
  KimapSDK.prototype.showAllFloors = function() {
617
627
  if (!this.floorGroups || this.floorGroups.length === 0) return;
618
- this.floorGroups.forEach(function(group) {
628
+ var self = this;
629
+ this.floorGroups.forEach(function(group, index) {
619
630
  group.visible = true;
631
+ // 恢复原始世界 Y 偏移(含间隙)
632
+ var originalY = self.core.floorOriginalY[index] || 0;
633
+ group.position.y = originalY;
620
634
  });
621
635
  };
622
636
 
@@ -64,6 +64,7 @@ function SceneCore(config) {
64
64
  this.floorGroups = [];
65
65
  this.floorHeight = 3; // 米
66
66
  this.isMultiFloor = Array.isArray(config.objUrl);
67
+ this.floorOriginalY = []; // 每个楼层的原始世界Y偏移(含间隙)
67
68
  }
68
69
 
69
70
  /**
@@ -420,7 +421,7 @@ SceneCore.prototype._processLoadedModelToGroup = function(object, materials, col
420
421
  var box = new THREE.Box3().setFromObject(object);
421
422
  var boxHeight = box.max.y - box.min.y;
422
423
 
423
- // 逐层累积高度:每个楼层的地面 = 前几个楼层的总高度
424
+ // 逐层累积高度:计算该楼层在 ALL 模式下的世界 Y 偏移
424
425
  var floorY = 0;
425
426
  for (var i = 0; i < floorIndex; i++) {
426
427
  var prevGroup = self.floorGroups[i];
@@ -430,9 +431,14 @@ SceneCore.prototype._processLoadedModelToGroup = function(object, materials, col
430
431
  }
431
432
  }
432
433
 
433
- // 修正当前楼层的 Y 偏移:使用 box.max.y(顶面高度)作为该楼层占据的高度基准,
434
- // 这样每个楼层的地面(min.y)都对齐到正确的世界高度
435
- object.position.set(-box.min.x, floorY - box.min.y, -box.min.z);
434
+ // 所有楼层的 object 底部(box.min.y)对齐到本地 Y=0,统一基准
435
+ object.position.set(-box.min.x, -box.min.y, -box.min.z);
436
+
437
+ // ALL 模式时 floorGroup.position.y 持有累积偏移(含间隙)
438
+ floorGroup.position.y = floorY;
439
+
440
+ // 记录每个楼层的原始世界 Y 偏移(单层模式时用于将选中层拽回 Y=0)
441
+ self.floorOriginalY[floorIndex] = floorY;
436
442
 
437
443
  // 复用 backup 的材质处理策略,不改渲染风格
438
444
  object.traverse(function(child) {