@smarterplan/ngx-smarterplan-core 1.2.26 → 1.2.28

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.
@@ -2487,8 +2487,9 @@ class Config {
2487
2487
  }
2488
2488
 
2489
2489
  class MatterportService {
2490
- constructor(config, router, visibilityService, ngZone) {
2490
+ constructor(config, router, activeRoute, visibilityService, ngZone) {
2491
2491
  this.router = router;
2492
+ this.activeRoute = activeRoute;
2492
2493
  this.visibilityService = visibilityService;
2493
2494
  this.ngZone = ngZone;
2494
2495
  this.slots = []; //SlotNode[] = [];
@@ -3442,21 +3443,20 @@ class MatterportService {
3442
3443
  break;
3443
3444
  case MattertagActionMode.POSITION_DATA:
3444
3445
  if (lastTag) {
3445
- this.router.navigate([`${this.router.url}`], {
3446
- queryParams: { positioning: true },
3446
+ this.router.navigate([], {
3447
+ relativeTo: this.activeRoute,
3448
+ queryParams: { positioning: true }, queryParamsHandling: "merge"
3447
3449
  });
3448
3450
  }
3449
3451
  break;
3450
3452
  case MattertagActionMode.POSITION_ROOM:
3451
3453
  if (lastTag) {
3452
- this.router.navigate([`${this.router.url}`], {
3453
- queryParams: { positioning: true },
3454
+ this.router.navigate([], {
3455
+ relativeTo: this.activeRoute,
3456
+ queryParams: { positioning: true }, queryParamsHandling: "merge"
3454
3457
  });
3455
3458
  }
3456
3459
  break;
3457
- default:
3458
- this.router.navigate([`${this.router.url}`]);
3459
- break;
3460
3460
  }
3461
3461
  }
3462
3462
  /**
@@ -3956,7 +3956,7 @@ class MatterportService {
3956
3956
  this.securityCameraAnimator.toggleViewFrustum();
3957
3957
  }
3958
3958
  }
3959
- MatterportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MatterportService, deps: [{ token: 'config' }, { token: i1$1.Router }, { token: BaseVisibilityService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
3959
+ MatterportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MatterportService, deps: [{ token: 'config' }, { token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: BaseVisibilityService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
3960
3960
  MatterportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MatterportService, providedIn: 'root' });
3961
3961
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MatterportService, decorators: [{
3962
3962
  type: Injectable,
@@ -3966,7 +3966,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
3966
3966
  }], ctorParameters: function () { return [{ type: Config, decorators: [{
3967
3967
  type: Inject,
3968
3968
  args: ['config']
3969
- }] }, { type: i1$1.Router }, { type: BaseVisibilityService }, { type: i0.NgZone }]; } });
3969
+ }] }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: BaseVisibilityService }, { type: i0.NgZone }]; } });
3970
3970
 
3971
3971
  /* eslint-disable no-await-in-loop */
3972
3972
  class ViewerService {
@@ -6180,12 +6180,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
6180
6180
  }] }]; } });
6181
6181
 
6182
6182
  class NavigatorService {
6183
- constructor(matterportService, viewerService, zoneService, userService, zoneChangeService) {
6183
+ constructor(matterportService, viewerService, zoneService, userService, zoneChangeService, router, route) {
6184
6184
  this.matterportService = matterportService;
6185
6185
  this.viewerService = viewerService;
6186
6186
  this.zoneService = zoneService;
6187
6187
  this.userService = userService;
6188
6188
  this.zoneChangeService = zoneChangeService;
6189
+ this.router = router;
6190
+ this.route = route;
6189
6191
  this.visitLastPosition = new Map();
6190
6192
  this.locationIDChange = new Subject();
6191
6193
  this.navBarZoneIDChange = new Subject();
@@ -6225,16 +6227,18 @@ class NavigatorService {
6225
6227
  const lastPose = this.matterportService.poseCamera;
6226
6228
  if (lastPose && this.currentModel3D && this.userService.cu) {
6227
6229
  this.visitLastPosition.set(this.currentModel3D, {
6228
- sweep: lastPose.sweep,
6229
- rotation: lastPose.rotation,
6230
+ /**Override sweep/rotation if exist */
6231
+ sweep: this.targetSweep ?? lastPose.sweep,
6232
+ rotation: this.targetRotation ?? lastPose.rotation,
6230
6233
  });
6231
6234
  }
6232
6235
  this.currentModel3D = data.model3D;
6233
6236
  }
6234
6237
  else {
6235
6238
  this.currentModel3D = data.model3D;
6236
- this.targetSweep = data.sweep;
6237
- this.targetRotation = data.rotation;
6239
+ /**Override sweep/rotation if exist. Target is reset after (null)*/
6240
+ this.targetSweep = this.targetSweep ?? data.sweep;
6241
+ this.targetRotation = this.targetRotation ?? data.rotation;
6238
6242
  this.onViewerLoaded().catch((e) => console.log(e));
6239
6243
  }
6240
6244
  });
@@ -6244,6 +6248,35 @@ class NavigatorService {
6244
6248
  this.visitLastPosition = new Map();
6245
6249
  }
6246
6250
  });
6251
+ this.route.queryParams.subscribe(params => {
6252
+ const deepParamsBase64 = params['deepParams'];
6253
+ if (deepParamsBase64) {
6254
+ const deepParams = JSON.parse(atob(deepParamsBase64));
6255
+ this.targetSweep = deepParams.sweepID;
6256
+ this.targetRotation = deepParams.rotation;
6257
+ /**Clear this query params */
6258
+ this.router.navigate([], {
6259
+ queryParams: { deepParams: null }, queryParamsHandling: "merge"
6260
+ });
6261
+ }
6262
+ });
6263
+ }
6264
+ getDeepLink() {
6265
+ let data = null;
6266
+ if (this.currentSweep) { /**Todo check matterport mod and adapt */
6267
+ data = {
6268
+ sweepID: this.currentSweep,
6269
+ rotation: this.matterportService.getCurrentCameraPosition().rotation
6270
+ };
6271
+ data = btoa(JSON.stringify(data));
6272
+ }
6273
+ const model3D = this.currentModel3D;
6274
+ const url = this.router.createUrlTree([], {
6275
+ relativeTo: this.route,
6276
+ queryParams: { deepParams: data, model3D },
6277
+ queryParamsHandling: "merge"
6278
+ });
6279
+ return `${location.origin}${url.toString()}`;
6247
6280
  }
6248
6281
  getLastPositionForModel(model3D) {
6249
6282
  return this.visitLastPosition.get(model3D);
@@ -6269,6 +6302,9 @@ class NavigatorService {
6269
6302
  rotation = this.targetRotation
6270
6303
  ? this.targetRotation
6271
6304
  : this.checkRotationForSweep(this.targetSweep);
6305
+ /**Reset / Consume target */
6306
+ this.targetRotation = null;
6307
+ this.targetSweep = null;
6272
6308
  }
6273
6309
  else {
6274
6310
  const lastPostion = this.getLastPositionForModel(this.currentModel3D);
@@ -6336,14 +6372,14 @@ class NavigatorService {
6336
6372
  // }
6337
6373
  }
6338
6374
  }
6339
- NavigatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NavigatorService, deps: [{ token: MatterportService }, { token: ViewerService }, { token: ZoneService }, { token: BaseUserService }, { token: ZoneChangeService }], target: i0.ɵɵFactoryTarget.Injectable });
6375
+ NavigatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NavigatorService, deps: [{ token: MatterportService }, { token: ViewerService }, { token: ZoneService }, { token: BaseUserService }, { token: ZoneChangeService }, { token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
6340
6376
  NavigatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NavigatorService, providedIn: 'root' });
6341
6377
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NavigatorService, decorators: [{
6342
6378
  type: Injectable,
6343
6379
  args: [{
6344
6380
  providedIn: 'root',
6345
6381
  }]
6346
- }], ctorParameters: function () { return [{ type: MatterportService }, { type: ViewerService }, { type: ZoneService }, { type: BaseUserService }, { type: ZoneChangeService }]; } });
6382
+ }], ctorParameters: function () { return [{ type: MatterportService }, { type: ViewerService }, { type: ZoneService }, { type: BaseUserService }, { type: ZoneChangeService }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
6347
6383
 
6348
6384
  /* eslint-disable class-methods-use-this */
6349
6385
  class InterventionService {