@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 +1 -1
- package/src/core/KimapSDK.js +21 -10
package/package.json
CHANGED
package/src/core/KimapSDK.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
-
* @
|
|
592
|
+
* @public
|
|
593
593
|
*/
|
|
594
|
-
KimapSDK.prototype.
|
|
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
|
-
* @
|
|
603
|
+
* @public
|
|
604
604
|
*/
|
|
605
|
-
KimapSDK.prototype.
|
|
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
|
|
839
|
-
var
|
|
840
|
-
var
|
|
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)
|