@kimap/indoor-positioning-sdk-vue2 5.7.0 → 5.7.2

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.0",
3
+ "version": "5.7.2",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -79,7 +79,7 @@ KimapSDK.prototype.init = function() {
79
79
 
80
80
  // 多楼层默认显示第一个楼层
81
81
  if (self.isMultiFloor && self.floorGroups && self.floorGroups.length > 0) {
82
- self._showSingleFloor(0);
82
+ self.showSingleFloor(0);
83
83
  }
84
84
 
85
85
  return self;
@@ -569,7 +569,7 @@ KimapSDK.prototype.changeFloor = function(floorIdOrIndex) {
569
569
  if (matched) floorIndex = parseInt(matched[1], 10);
570
570
  }
571
571
  if (floorIndex >= 0 && floorIndex < this.floorGroups.length) {
572
- this._showSingleFloor(floorIndex);
572
+ this.showSingleFloor(floorIndex);
573
573
  }
574
574
  }
575
575
 
@@ -589,9 +589,9 @@ KimapSDK.prototype.changeFloor = function(floorIdOrIndex) {
589
589
 
590
590
  /**
591
591
  * 多楼层:显示单层
592
- * @private
592
+ * @public
593
593
  */
594
- KimapSDK.prototype._showSingleFloor = function(floorIndex) {
594
+ KimapSDK.prototype.showSingleFloor = function(floorIndex) {
595
595
  if (!this.floorGroups || this.floorGroups.length === 0) return;
596
596
  this.floorGroups.forEach(function(group, index) {
597
597
  group.visible = index === floorIndex;
@@ -600,15 +600,24 @@ KimapSDK.prototype._showSingleFloor = function(floorIndex) {
600
600
 
601
601
  /**
602
602
  * 多楼层:显示全部楼层
603
- * @private
603
+ * @public
604
604
  */
605
- KimapSDK.prototype._showAllFloors = function() {
605
+ KimapSDK.prototype.showAllFloors = function() {
606
606
  if (!this.floorGroups || this.floorGroups.length === 0) return;
607
607
  this.floorGroups.forEach(function(group) {
608
608
  group.visible = true;
609
609
  });
610
610
  };
611
611
 
612
+ /**
613
+ * 多楼层:是否正在显示所有楼层
614
+ * @public
615
+ */
616
+ KimapSDK.prototype.isShowingAllFloors = function() {
617
+ if (!this.floorGroups || this.floorGroups.length === 0) return false;
618
+ return this.floorGroups.every(function(group) { return group.visible; });
619
+ };
620
+
612
621
  /**
613
622
  * 获取当前楼层
614
623
  * @returns {Object|null} 当前楼层对象
@@ -833,11 +842,13 @@ KimapSDK.prototype.loadKMData = function() {
833
842
  return Promise.resolve({ success: false, message: '未配置objUrl' });
834
843
  }
835
844
 
836
- // 从objUrl提取文件名和目录
845
+ // 从objUrl提取文件名和目录(支持数组或字符串)
837
846
  var objUrl = this.config.objUrl;
838
- var lastSlashIndex = objUrl.lastIndexOf('/');
839
- var directory = lastSlashIndex >= 0 ? objUrl.substring(0, lastSlashIndex) : '';
840
- var fileName = objUrl.split('/').pop().replace(/\.(obj|kimap)$/i, '');
847
+ var isArray = Array.isArray(objUrl);
848
+ var firstUrl = isArray ? objUrl[0] : objUrl;
849
+ var lastSlashIndex = firstUrl.lastIndexOf('/');
850
+ var directory = lastSlashIndex >= 0 ? firstUrl.substring(0, lastSlashIndex) : '';
851
+ var fileName = firstUrl.split('/').pop().replace(/\.(obj|kimap)$/i, '');
841
852
  var kidataUrl = directory + '/' + fileName + '.kidata';
842
853
 
843
854
  return fetch(kidataUrl)