@smarterplan/ngx-smarterplan-core 1.2.53 → 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.
@@ -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';
@@ -1795,11 +1795,11 @@ class ZoneChangeService {
1795
1795
  this.zonesForUserChange = new Subject();
1796
1796
  this.floorHasChanged = new EventEmitter();
1797
1797
  this.zoneChange.subscribe((zone) => {
1798
- // console.log(`new zone ${JSON.stringify(zone)}`);
1798
+ //console.log(`new zone ${JSON.stringify(zone)}`);
1799
1799
  this.currentZone = zone;
1800
1800
  });
1801
1801
  this.zonesForUserChange.subscribe((zones) => {
1802
- // console.log(`new zones ${JSON.stringify(zones)}`);
1802
+ //console.log(`new zones ${JSON.stringify(zones)}`);
1803
1803
  this.currentZones = zones;
1804
1804
  });
1805
1805
  }
@@ -2757,26 +2757,108 @@ class MatterportService {
2757
2757
  this.floors = Object.values(collection);
2758
2758
  }.bind(this),
2759
2759
  });
2760
- // on tag click open details page
2761
- this.sdk.on('tag.click', (sid) => {
2762
- // get object of this tag
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
- console.log('no mattertagData to display');
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
- console.log('Cannot show details for tag');
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
@@ -4068,6 +4150,7 @@ class ViewerService {
4068
4150
  this.dataIsLoaded = new Subject();
4069
4151
  this.isLoaded = false;
4070
4152
  this.showingViewer = false;
4153
+ this.goToTriggered = new Subject();
4071
4154
  this.toolboxStates = {
4072
4155
  dollhouse: {
4073
4156
  stat: false,
@@ -10997,6 +11080,7 @@ class NavigationBarComponent {
10997
11080
  zone.parentID === parentZoneForVisit.id);
10998
11081
  }
10999
11082
  async goTo() {
11083
+ this.viewerService.goToTriggered.next();
11000
11084
  if (this.selectedZone && !this.selectedZone.virtual) {
11001
11085
  this.sweepToGo = this.selectedZone.startSweepID
11002
11086
  ? this.selectedZone.startSweepID