@smarterplan/ngx-smarterplan-locations 0.2.5 → 0.2.7

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.
@@ -2936,7 +2936,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
2936
2936
  }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i2.SpaceService }, { type: i2.VisitService }, { type: i2.NodeService }]; } });
2937
2937
 
2938
2938
  class EditPlanComponent {
2939
- constructor(planService, route, router, modalService, zoneService, visitService, spaceService, translate) {
2939
+ constructor(planService, route, router, modalService, zoneService, visitService, spaceService, translate, ngZone) {
2940
2940
  this.planService = planService;
2941
2941
  this.route = route;
2942
2942
  this.router = router;
@@ -2945,6 +2945,7 @@ class EditPlanComponent {
2945
2945
  this.visitService = visitService;
2946
2946
  this.spaceService = spaceService;
2947
2947
  this.translate = translate;
2948
+ this.ngZone = ngZone;
2948
2949
  this.loading = false;
2949
2950
  this.isNewZone = false;
2950
2951
  /**
@@ -3038,9 +3039,7 @@ class EditPlanComponent {
3038
3039
  this.images360 = await this.visitService.loadImagesForSpace(currentSpace);
3039
3040
  this.editedPlan = { ...this.chosenPlan };
3040
3041
  this.editedPlan.filepath = base64;
3041
- console.log(event.data);
3042
3042
  this.newZoneData = event.data.zoneData;
3043
- console.log("newZoneData", this.newZoneData);
3044
3043
  if (this.newZoneData.elements.length === 0) {
3045
3044
  modalReference.close();
3046
3045
  alert(this.translate.instant("edition.no-zone"));
@@ -3073,8 +3072,6 @@ class EditPlanComponent {
3073
3072
  this.svgEditorIframe = svgEditor;
3074
3073
  this.svgEditor = new svgEditor.contentWindow.SvgEditor();
3075
3074
  await this.svgEditor.init();
3076
- // await this.svgEditor.pref(key, val);
3077
- // await this.svgEditor.setConfig({ extentions: this.extensions });
3078
3075
  await this.svgEditor.setConfig(this.config, {
3079
3076
  allowInitialUserOverride: true,
3080
3077
  });
@@ -3089,10 +3086,11 @@ class EditPlanComponent {
3089
3086
  this.svgEditorIframe.contentWindow.postMessage({ action: "disable-zone" }, "*");
3090
3087
  }, 1000);
3091
3088
  }
3089
+ this.svgEditor.svgCanvas.setMode('ext-panning');
3090
+ this.svgEditor.bottomPanel.changeZoom(50);
3092
3091
  }
3093
3092
  }
3094
3093
  async onSave(redirect) {
3095
- console.log("in onSave");
3096
3094
  const imgBlob = await new Blob([this.svgEditor.svgCanvas.getSvgString()], {
3097
3095
  type: "image/svg+xml",
3098
3096
  });
@@ -3103,14 +3101,14 @@ class EditPlanComponent {
3103
3101
  });
3104
3102
  this.planService.setPlanFileCache(imgFile);
3105
3103
  if (this.chosenPlan.isModified) {
3106
- this.modalService.open(this.dialog);
3104
+ this.ngZone.run(() => this.modalService.open(this.dialog));
3107
3105
  }
3108
3106
  else {
3109
- this.router.navigate([
3107
+ this.ngZone.run(() => this.router.navigate([
3110
3108
  "/dashboard/localisation",
3111
3109
  this.spaceID,
3112
3110
  "plans",
3113
- ]);
3111
+ ]));
3114
3112
  }
3115
3113
  }
3116
3114
  async updateSvg() {
@@ -3120,25 +3118,25 @@ class EditPlanComponent {
3120
3118
  annexe: newUrl,
3121
3119
  });
3122
3120
  this.planService.setPlanFileCache(null);
3123
- this.router.navigate([
3121
+ this.ngZone.run(() => this.router.navigate([
3124
3122
  "/dashboard/localisation",
3125
3123
  this.spaceID,
3126
3124
  "plans",
3127
- ]);
3125
+ ]));
3128
3126
  }
3129
3127
  async newSvg() {
3130
- this.router.navigate([
3128
+ this.ngZone.run(() => this.router.navigate([
3131
3129
  "/dashboard/localisation",
3132
3130
  this.spaceID,
3133
3131
  "plans",
3134
- ]);
3132
+ ]));
3135
3133
  }
3136
3134
  async onCancel() {
3137
- this.router.navigate([
3135
+ this.ngZone.run(() => this.router.navigate([
3138
3136
  "/dashboard/localisation",
3139
3137
  this.spaceID,
3140
3138
  "plans",
3141
- ]);
3139
+ ]));
3142
3140
  alert(this.translate.instant("edition.cancel"));
3143
3141
  }
3144
3142
  async loadSvg() {
@@ -3184,6 +3182,8 @@ class EditPlanComponent {
3184
3182
  },
3185
3183
  });
3186
3184
  this.svgEditor.svgCanvas.setHref(newImage, canvas.toDataURL("image/png"));
3185
+ this.svgEditor.svgCanvas.renameCurrentLayer(this.translate.instant("edition.plan-base"));
3186
+ this.svgEditor.svgCanvas.createLayer(this.translate.instant("edition.personalization"));
3187
3187
  });
3188
3188
  }
3189
3189
  async onLoadImg(img) {
@@ -3211,6 +3211,8 @@ class EditPlanComponent {
3211
3211
  },
3212
3212
  });
3213
3213
  this.svgEditor.svgCanvas.setHref(newImage, reader.result);
3214
+ this.svgEditor.svgCanvas.renameCurrentLayer(this.translate.instant("edition.plan-base"));
3215
+ this.svgEditor.svgCanvas.createLayer(this.translate.instant("edition.personalization"));
3214
3216
  };
3215
3217
  reader.readAsDataURL(imgBlob);
3216
3218
  }
@@ -3225,12 +3227,12 @@ class EditPlanComponent {
3225
3227
  }
3226
3228
  }
3227
3229
  }
3228
- EditPlanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: EditPlanComponent, deps: [{ token: i2.PlanService }, { token: i1.ActivatedRoute }, { token: i1.Router }, { token: i7.NgbModal }, { token: i2.ZoneService }, { token: i2.VisitService }, { token: i2.SpaceService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
3230
+ EditPlanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: EditPlanComponent, deps: [{ token: i2.PlanService }, { token: i1.ActivatedRoute }, { token: i1.Router }, { token: i7.NgbModal }, { token: i2.ZoneService }, { token: i2.VisitService }, { token: i2.SpaceService }, { token: i3.TranslateService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
3229
3231
  EditPlanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: EditPlanComponent, selector: "lib-edit-plan", host: { listeners: { "window:message": "switchAction($event)" } }, viewQueries: [{ propertyName: "dialog", first: true, predicate: ["dialog"], descendants: true }, { propertyName: "dialogZone", first: true, predicate: ["dialogZone"], descendants: true }, { propertyName: "loadingModal", first: true, predicate: ["preparing"], descendants: true }], ngImport: i0, template: "<div class=\"row mt-3\">\r\n <div class=\"col\">\r\n <div class=\"m-3\">\r\n <lib-tab-navigation [menuItems]='menuItems'></lib-tab-navigation>\r\n </div>\r\n </div>\r\n</div>\r\n<lib-add-zone *ngIf=\"isNewZone\" [images360]=\"images360\" [spaceID]=\"spaceID\" [navigationIDs]=\"navigations\"\r\n [zoneEdit]=\"editedZone\" [zones]=\"zones\" (updatedZone)=\"onNewZone($event)\" [chosenPlan]=\"editedPlan\"\r\n [newZoneDataFromEditor]=\"newZoneData\"></lib-add-zone>\r\n<iframe *ngIf=\"editorUrl\" #svgEditor [src]=\"editorUrl | safeUrl\" frameborder=\"0\"\r\n style=\"height:100%;width:100%;min-height:550px;max-height:750px\" (load)=\"onLoad(svgEditor)\"></iframe>\r\n<!-- chosenPlan && -->\r\n<!-- ./../../../../../../assets/svgeditor/index.html -->\r\n\r\n<img #imgPng *ngIf=\"chosenPlan && chosenPlan.extension !== 'svg' && svgEditor\" [src]=\"chosenPlan.filepath\"\r\n (load)=\"onLoadImg(imgPng)\" style=\"display: none;\">\r\n\r\n<canvas id=\"canvas4pdf\" style=\"display: none;\"></canvas>\r\n\r\n<ng-template #dialog let-modal>\r\n\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Submit' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{'save plan edited' | translate}}\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"newSvg();modal.close('Close click')\">{{'Yes' |\r\n translate}}</button>\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"updateSvg();modal.close('Close click')\">{{'No' |\r\n translate}}</button>\r\n </div>\r\n\r\n</ng-template>\r\n\r\n<ng-template #dialogZone let-modal>\r\n\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Submit' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{'confirm.new-zone-from-plan' | translate}}\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-outline-dark\"\r\n (click)=\"isNewZone = true;modal.close('Close click')\">{{'Validate' |\r\n translate}}</button>\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"modal.close('Close click')\">{{'Cancel' |\r\n translate}}</button>\r\n </div>\r\n\r\n</ng-template>\r\n\r\n<ng-template #preparing let-modal>\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Processing' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"spinner-border\" role=\"status\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</ng-template>", styles: ["app-add-zone{position:absolute;top:0;left:0;background-color:#fff;width:100%;height:100%;padding:30px}\n"], components: [{ type: TabNavigationComponent, selector: "lib-tab-navigation", inputs: ["menuItems"], outputs: ["onGoBack"] }, { type: AddZoneComponent, selector: "lib-add-zone", inputs: ["zoneEdit", "spaceID", "images360", "navigationIDs", "zones", "newZoneDataFromEditor", "chosenPlan", "isMuseumVisit", "defaultZone"], outputs: ["updatedZone"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "safeUrl": i2.SafeUrlPipe, "translate": i3.TranslatePipe } });
3230
3232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: EditPlanComponent, decorators: [{
3231
3233
  type: Component,
3232
3234
  args: [{ selector: 'lib-edit-plan', template: "<div class=\"row mt-3\">\r\n <div class=\"col\">\r\n <div class=\"m-3\">\r\n <lib-tab-navigation [menuItems]='menuItems'></lib-tab-navigation>\r\n </div>\r\n </div>\r\n</div>\r\n<lib-add-zone *ngIf=\"isNewZone\" [images360]=\"images360\" [spaceID]=\"spaceID\" [navigationIDs]=\"navigations\"\r\n [zoneEdit]=\"editedZone\" [zones]=\"zones\" (updatedZone)=\"onNewZone($event)\" [chosenPlan]=\"editedPlan\"\r\n [newZoneDataFromEditor]=\"newZoneData\"></lib-add-zone>\r\n<iframe *ngIf=\"editorUrl\" #svgEditor [src]=\"editorUrl | safeUrl\" frameborder=\"0\"\r\n style=\"height:100%;width:100%;min-height:550px;max-height:750px\" (load)=\"onLoad(svgEditor)\"></iframe>\r\n<!-- chosenPlan && -->\r\n<!-- ./../../../../../../assets/svgeditor/index.html -->\r\n\r\n<img #imgPng *ngIf=\"chosenPlan && chosenPlan.extension !== 'svg' && svgEditor\" [src]=\"chosenPlan.filepath\"\r\n (load)=\"onLoadImg(imgPng)\" style=\"display: none;\">\r\n\r\n<canvas id=\"canvas4pdf\" style=\"display: none;\"></canvas>\r\n\r\n<ng-template #dialog let-modal>\r\n\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Submit' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{'save plan edited' | translate}}\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"newSvg();modal.close('Close click')\">{{'Yes' |\r\n translate}}</button>\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"updateSvg();modal.close('Close click')\">{{'No' |\r\n translate}}</button>\r\n </div>\r\n\r\n</ng-template>\r\n\r\n<ng-template #dialogZone let-modal>\r\n\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Submit' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n {{'confirm.new-zone-from-plan' | translate}}\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-outline-dark\"\r\n (click)=\"isNewZone = true;modal.close('Close click')\">{{'Validate' |\r\n translate}}</button>\r\n <button type=\"button\" class=\"btn btn-outline-dark\" (click)=\"modal.close('Close click')\">{{'Cancel' |\r\n translate}}</button>\r\n </div>\r\n\r\n</ng-template>\r\n\r\n<ng-template #preparing let-modal>\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title\">{{'Processing' | translate}}</h4>\r\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"modal.dismiss('Cross click')\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"spinner-border\" role=\"status\">\r\n <span class=\"visually-hidden\">Loading...</span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</ng-template>", styles: ["app-add-zone{position:absolute;top:0;left:0;background-color:#fff;width:100%;height:100%;padding:30px}\n"] }]
3233
- }], ctorParameters: function () { return [{ type: i2.PlanService }, { type: i1.ActivatedRoute }, { type: i1.Router }, { type: i7.NgbModal }, { type: i2.ZoneService }, { type: i2.VisitService }, { type: i2.SpaceService }, { type: i3.TranslateService }]; }, propDecorators: { dialog: [{
3235
+ }], ctorParameters: function () { return [{ type: i2.PlanService }, { type: i1.ActivatedRoute }, { type: i1.Router }, { type: i7.NgbModal }, { type: i2.ZoneService }, { type: i2.VisitService }, { type: i2.SpaceService }, { type: i3.TranslateService }, { type: i0.NgZone }]; }, propDecorators: { dialog: [{
3234
3236
  type: ViewChild,
3235
3237
  args: ["dialog"]
3236
3238
  }], dialogZone: [{