@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 { Subject, takeUntil, Observable } from 'rxjs';
|
|
@@ -2757,26 +2757,108 @@ class MatterportService {
|
|
|
2757
2757
|
this.floors = Object.values(collection);
|
|
2758
2758
|
}.bind(this),
|
|
2759
2759
|
});
|
|
2760
|
-
//
|
|
2761
|
-
|
|
2762
|
-
|
|
2760
|
+
// Handler générique pour les sélections de tags
|
|
2761
|
+
const handleTagSelection = async (sid, source, evt) => {
|
|
2762
|
+
if (isDevMode()) {
|
|
2763
|
+
console.log(`[MatterportService] handleTagSelection from ${source} for sid: ${sid}`, { evt });
|
|
2764
|
+
}
|
|
2765
|
+
// Exécution de l'action personnalisée (ouverture du panneau de détail via navigation)
|
|
2763
2766
|
try {
|
|
2764
2767
|
const mattertagData = this.dictionnaryTags.get(sid);
|
|
2765
2768
|
if (!mattertagData) {
|
|
2766
|
-
|
|
2769
|
+
if (isDevMode()) {
|
|
2770
|
+
console.log('no mattertagData to display', sid);
|
|
2771
|
+
}
|
|
2767
2772
|
return;
|
|
2768
2773
|
}
|
|
2769
2774
|
const url = tagService.getUrlForSeeDetails(mattertagData.getObject(), mattertagData.getType());
|
|
2770
2775
|
if (url !== '') {
|
|
2776
|
+
if (isDevMode()) {
|
|
2777
|
+
console.log(`[MatterportService] Navigating to detail URL: ${url}`);
|
|
2778
|
+
}
|
|
2771
2779
|
this.visibilityService.detailShowing.next(true);
|
|
2772
2780
|
this.ngZone.run(() => {
|
|
2773
2781
|
this.router.navigate([url]);
|
|
2774
2782
|
});
|
|
2775
2783
|
}
|
|
2776
2784
|
}
|
|
2777
|
-
catch {
|
|
2778
|
-
|
|
2785
|
+
catch (error) {
|
|
2786
|
+
if (isDevMode()) {
|
|
2787
|
+
console.log('Cannot show details for tag', error);
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
};
|
|
2791
|
+
// Fonction pour désactiver les actions natives sur un tag (SDK v3)
|
|
2792
|
+
const disableNativeActions = (sid) => {
|
|
2793
|
+
if (!this.sdk)
|
|
2794
|
+
return;
|
|
2795
|
+
try {
|
|
2796
|
+
if (this.sdk.Tag && this.sdk.Tag.allowAction) {
|
|
2797
|
+
// opening: false désactive le billboard natif
|
|
2798
|
+
// navigating: false désactive le déplacement de la caméra vers le tag
|
|
2799
|
+
this.sdk.Tag.allowAction(sid, { opening: false, navigating: false, docking: false });
|
|
2800
|
+
if (isDevMode()) {
|
|
2801
|
+
console.log(`[MatterportService] Disabled native actions for tag ${sid}`);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
else if (this.sdk.Mattertag && this.sdk.Mattertag.preventAction) {
|
|
2805
|
+
// Fallback ancienne API
|
|
2806
|
+
this.sdk.Mattertag.preventAction(sid, { opening: true, navigating: true });
|
|
2807
|
+
if (isDevMode()) {
|
|
2808
|
+
console.log(`[MatterportService] Prevented native actions (legacy) for tag ${sid}`);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
catch (e) {
|
|
2813
|
+
if (isDevMode()) {
|
|
2814
|
+
console.warn(`[MatterportService] Error disabling actions for ${sid}`, e);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
// Attendre que l'application soit en phase PLAYING
|
|
2819
|
+
if (this.sdk.App && this.sdk.App.state) {
|
|
2820
|
+
if (isDevMode()) {
|
|
2821
|
+
console.log('[MatterportService] Waiting for App.Phase.PLAYING...');
|
|
2822
|
+
}
|
|
2823
|
+
this.sdk.App.state.waitUntil((s) => s.phase === this.sdk.App.Phase.PLAYING).then(() => {
|
|
2824
|
+
if (isDevMode()) {
|
|
2825
|
+
console.log('[MatterportService] App is PLAYING.');
|
|
2826
|
+
}
|
|
2827
|
+
// 1. Désactiver les actions natives pour tous les tags existants et futurs
|
|
2828
|
+
if (this.sdk.Tag && this.sdk.Tag.data) {
|
|
2829
|
+
this.sdk.Tag.data.subscribe({
|
|
2830
|
+
onAdded: (sid) => {
|
|
2831
|
+
disableNativeActions(sid);
|
|
2832
|
+
},
|
|
2833
|
+
onUpdated: (sid) => {
|
|
2834
|
+
disableNativeActions(sid);
|
|
2835
|
+
},
|
|
2836
|
+
onCollectionUpdated: (collection) => {
|
|
2837
|
+
Object.keys(collection).forEach(sid => disableNativeActions(sid));
|
|
2838
|
+
}
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
// 2. Écouter les sélections via l'observable openTags (Méthode moderne)
|
|
2842
|
+
if (this.sdk.Tag && this.sdk.Tag.openTags) {
|
|
2843
|
+
this.sdk.Tag.openTags.subscribe({
|
|
2844
|
+
onChanged: (newState) => {
|
|
2845
|
+
if (newState.selected && newState.selected.size > 0) {
|
|
2846
|
+
const sid = Array.from(newState.selected)[0];
|
|
2847
|
+
handleTagSelection(sid, 'Tag.openTags.selected');
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
// Fallback pour l'événement global tag.click
|
|
2855
|
+
this.sdk.on('tag.click', (sid) => {
|
|
2856
|
+
if (isDevMode()) {
|
|
2857
|
+
console.log(`[MatterportService] sdk.on('tag.click') received for sid: ${sid}`);
|
|
2779
2858
|
}
|
|
2859
|
+
handleTagSelection(sid, 'global.tag.click');
|
|
2860
|
+
// On s'assure qu'il est bien désactivé même si on a raté l'évènement d'ajout
|
|
2861
|
+
disableNativeActions(sid);
|
|
2780
2862
|
});
|
|
2781
2863
|
// Pointer trick
|
|
2782
2864
|
// Create a div that will appear when the cursor is still
|