@smarterplan/ngx-smarterplan-core 1.2.27 → 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.
@@ -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 {