@smarterplan/ngx-smarterplan-core 1.2.54 → 1.2.55
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/esm2020/lib/services/matterport.service.mjs +90 -8
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +89 -7
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +89 -7
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, Input, Inject, EventEmitter, Output, Pipe, ViewChild, NgModule } from '@angular/core';
|
|
2
|
+
import { Injectable, Component, Input, Inject, EventEmitter, isDevMode, Output, Pipe, ViewChild, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule } from '@ngx-translate/core';
|
|
5
5
|
import { __awaiter } from 'tslib';
|
|
@@ -2875,26 +2875,108 @@ class MatterportService {
|
|
|
2875
2875
|
this.floors = Object.values(collection);
|
|
2876
2876
|
}.bind(this),
|
|
2877
2877
|
});
|
|
2878
|
-
//
|
|
2879
|
-
|
|
2880
|
-
|
|
2878
|
+
// Handler générique pour les sélections de tags
|
|
2879
|
+
const handleTagSelection = (sid, source, evt) => __awaiter(this, void 0, void 0, function* () {
|
|
2880
|
+
if (isDevMode()) {
|
|
2881
|
+
console.log(`[MatterportService] handleTagSelection from ${source} for sid: ${sid}`, { evt });
|
|
2882
|
+
}
|
|
2883
|
+
// Exécution de l'action personnalisée (ouverture du panneau de détail via navigation)
|
|
2881
2884
|
try {
|
|
2882
2885
|
const mattertagData = this.dictionnaryTags.get(sid);
|
|
2883
2886
|
if (!mattertagData) {
|
|
2884
|
-
|
|
2887
|
+
if (isDevMode()) {
|
|
2888
|
+
console.log('no mattertagData to display', sid);
|
|
2889
|
+
}
|
|
2885
2890
|
return;
|
|
2886
2891
|
}
|
|
2887
2892
|
const url = tagService.getUrlForSeeDetails(mattertagData.getObject(), mattertagData.getType());
|
|
2888
2893
|
if (url !== '') {
|
|
2894
|
+
if (isDevMode()) {
|
|
2895
|
+
console.log(`[MatterportService] Navigating to detail URL: ${url}`);
|
|
2896
|
+
}
|
|
2889
2897
|
this.visibilityService.detailShowing.next(true);
|
|
2890
2898
|
this.ngZone.run(() => {
|
|
2891
2899
|
this.router.navigate([url]);
|
|
2892
2900
|
});
|
|
2893
2901
|
}
|
|
2894
2902
|
}
|
|
2895
|
-
catch (
|
|
2896
|
-
|
|
2903
|
+
catch (error) {
|
|
2904
|
+
if (isDevMode()) {
|
|
2905
|
+
console.log('Cannot show details for tag', error);
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
});
|
|
2909
|
+
// Fonction pour désactiver les actions natives sur un tag (SDK v3)
|
|
2910
|
+
const disableNativeActions = (sid) => {
|
|
2911
|
+
if (!this.sdk)
|
|
2912
|
+
return;
|
|
2913
|
+
try {
|
|
2914
|
+
if (this.sdk.Tag && this.sdk.Tag.allowAction) {
|
|
2915
|
+
// opening: false désactive le billboard natif
|
|
2916
|
+
// navigating: false désactive le déplacement de la caméra vers le tag
|
|
2917
|
+
this.sdk.Tag.allowAction(sid, { opening: false, navigating: false, docking: false });
|
|
2918
|
+
if (isDevMode()) {
|
|
2919
|
+
console.log(`[MatterportService] Disabled native actions for tag ${sid}`);
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
else if (this.sdk.Mattertag && this.sdk.Mattertag.preventAction) {
|
|
2923
|
+
// Fallback ancienne API
|
|
2924
|
+
this.sdk.Mattertag.preventAction(sid, { opening: true, navigating: true });
|
|
2925
|
+
if (isDevMode()) {
|
|
2926
|
+
console.log(`[MatterportService] Prevented native actions (legacy) for tag ${sid}`);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
catch (e) {
|
|
2931
|
+
if (isDevMode()) {
|
|
2932
|
+
console.warn(`[MatterportService] Error disabling actions for ${sid}`, e);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
// Attendre que l'application soit en phase PLAYING
|
|
2937
|
+
if (this.sdk.App && this.sdk.App.state) {
|
|
2938
|
+
if (isDevMode()) {
|
|
2939
|
+
console.log('[MatterportService] Waiting for App.Phase.PLAYING...');
|
|
2940
|
+
}
|
|
2941
|
+
this.sdk.App.state.waitUntil((s) => s.phase === this.sdk.App.Phase.PLAYING).then(() => {
|
|
2942
|
+
if (isDevMode()) {
|
|
2943
|
+
console.log('[MatterportService] App is PLAYING.');
|
|
2944
|
+
}
|
|
2945
|
+
// 1. Désactiver les actions natives pour tous les tags existants et futurs
|
|
2946
|
+
if (this.sdk.Tag && this.sdk.Tag.data) {
|
|
2947
|
+
this.sdk.Tag.data.subscribe({
|
|
2948
|
+
onAdded: (sid) => {
|
|
2949
|
+
disableNativeActions(sid);
|
|
2950
|
+
},
|
|
2951
|
+
onUpdated: (sid) => {
|
|
2952
|
+
disableNativeActions(sid);
|
|
2953
|
+
},
|
|
2954
|
+
onCollectionUpdated: (collection) => {
|
|
2955
|
+
Object.keys(collection).forEach(sid => disableNativeActions(sid));
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
// 2. Écouter les sélections via l'observable openTags (Méthode moderne)
|
|
2960
|
+
if (this.sdk.Tag && this.sdk.Tag.openTags) {
|
|
2961
|
+
this.sdk.Tag.openTags.subscribe({
|
|
2962
|
+
onChanged: (newState) => {
|
|
2963
|
+
if (newState.selected && newState.selected.size > 0) {
|
|
2964
|
+
const sid = Array.from(newState.selected)[0];
|
|
2965
|
+
handleTagSelection(sid, 'Tag.openTags.selected');
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
// Fallback pour l'événement global tag.click
|
|
2973
|
+
this.sdk.on('tag.click', (sid) => {
|
|
2974
|
+
if (isDevMode()) {
|
|
2975
|
+
console.log(`[MatterportService] sdk.on('tag.click') received for sid: ${sid}`);
|
|
2897
2976
|
}
|
|
2977
|
+
handleTagSelection(sid, 'global.tag.click');
|
|
2978
|
+
// On s'assure qu'il est bien désactivé même si on a raté l'évènement d'ajout
|
|
2979
|
+
disableNativeActions(sid);
|
|
2898
2980
|
});
|
|
2899
2981
|
// Pointer trick
|
|
2900
2982
|
// Create a div that will appear when the cursor is still
|