@colijnit/homedecorator 261.20.8 → 261.20.9

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Pipe, Component, Inject, Input, HostBinding, Optional, ViewChild, EventEmitter, ElementRef, Output, Directive, ChangeDetectionStrategy, ViewEncapsulation, HostListener, SkipSelf, Self, NgModule, NO_ERRORS_SCHEMA, forwardRef } from '@angular/core';
3
3
  import * as THREE from 'three';
4
4
  import { Vector2, Mesh, Object3D, PointLight, Matrix4, Box3, Vector3, Euler, BoxGeometry, MeshBasicMaterial, Scene, LinearSRGBColorSpace, SRGBColorSpace, AxesHelper, Group, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial, CylinderGeometry, EquirectangularReflectionMapping, Material as Material$1, Texture as Texture$1, Source, EventDispatcher, Color, PerspectiveCamera, Quaternion, PlaneGeometry, DoubleSide, MeshStandardMaterial, RingGeometry, MathUtils, Raycaster, DataTexture, UnsignedByteType, LinearFilter, Shape, SphereGeometry, PCFSoftShadowMap, ShadowMaterial, LightProbe, DirectionalLight, MeshPhongMaterial, BackSide, FrontSide, NoToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, NeutralToneMapping, BasicShadowMap, PCFShadowMap, VSMShadowMap, OrthographicCamera, WebGLRenderer, TextureLoader, EllipseCurve, ArcCurve, NearestFilter, MeshPhysicalMaterial, Path, ShapeGeometry, ConeGeometry, ObjectLoader, Light, Camera as Camera$1, RepeatWrapping, SpotLight, AmbientLight, HemisphereLight, AdditiveBlending, LineSegments, EdgesGeometry, CircleGeometry, ExtrudeGeometry, InstancedMesh, Clock, AnimationMixer, AnimationClip, BufferAttribute, NoColorSpace, ArrowHelper as ArrowHelper$1, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, NearestMipmapNearestFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipMapLinearFilter, LinearMipmapNearestFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipMapLinearFilter, AlphaFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, ClampToEdgeWrapping, MirroredRepeatWrapping, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, NoBlending, NormalBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, ZeroStencilOp, KeepStencilOp, ReplaceStencilOp, IncrementStencilOp, DecrementStencilOp, IncrementWrapStencilOp, DecrementWrapStencilOp, InvertStencilOp, NeverStencilFunc, LessStencilFunc, EqualStencilFunc, LessEqualStencilFunc, GreaterStencilFunc, NotEqualStencilFunc, GreaterEqualStencilFunc, AlwaysStencilFunc, SpotLightHelper, DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, GridHelper, PMREMGenerator, BoxHelper } from 'three';
5
- import { BehaviorSubject, Subject, Observable, throwError, ReplaySubject, combineLatest, filter as filter$1, from } from 'rxjs';
5
+ import { BehaviorSubject, Subject, Observable, throwError, ReplaySubject, combineLatest, filter as filter$1, take as take$1, from } from 'rxjs';
6
6
  import * as TWEEN from '@tweenjs/tween.js';
7
7
  import { Selection } from '@colijnit/configuratorapi/build/model/selection';
8
8
  import { HdecoPositioning } from '@colijnit/configuratorapi/build/enum/hdeco-positioning.enum';
@@ -44391,10 +44391,15 @@ class ThreedselectorComponent {
44391
44391
  this._loadedFromPreset = false;
44392
44392
  this._loadedFromProject = false;
44393
44393
  this._loadedShouldCopyInstance = false;
44394
+ this._userActionNeeded = false;
44394
44395
  this._presetsService.register(this);
44395
44396
  }
44396
44397
  ngOnInit() {
44397
44398
  this._subs.push(this._appEventService.answerCountReceived.subscribe((answerCount) => this._handleAnswerCountReceived(answerCount)), this._messageBus.subscribe(MessageType.LoadIOneFurnitureIntoSceneBySKU, ({ sku, settings, position }) => this._handleLoadIOneFurnitureIntoSceneBySKU(sku, settings, position)), this._messageBus.subscribe(MessageType.CopyIOneFurnitureIntoSceneBySKU, (original) => this._handleCopyIOneFurnitureIntoSceneBySKU(original)), this._configuratorEventService.buildFinished.subscribe((result) => {
44399
+ if (this._userActionNeeded) {
44400
+ this._resetConfigurator(true);
44401
+ this._userActionNeeded = false;
44402
+ }
44398
44403
  this.handleBuildResult(result);
44399
44404
  }), this._buildFurnitureService.currentActiveService.configureModeChanged.subscribe(configuringModeChange => this._handleConfigureModeChange(configuringModeChange)), this._buildFurnitureService.currentActiveService.toggleSelectedElement.subscribe((element) => this._selectedElementToggle(element)), this._buildFurnitureService.currentActiveService.buildFinished.subscribe((result) => this._handleBuildFinished(result)), this._buildFurnitureService.currentActiveService.answerSelected.subscribe((result) => this._answerSelected(result)), this._sceneService.onAfterRender.subscribe(() => this._handleRender()),
44400
44405
  // this._appService.skuSet.subscribe(sku => this._handleSkuSet(sku)),
@@ -44596,7 +44601,7 @@ class ThreedselectorComponent {
44596
44601
  this._sceneService.needsRender = true;
44597
44602
  }
44598
44603
  else if (result.resultType === ResultType.NeedsUserInput) {
44599
- // this._configuringService.isConfiguring = true;
44604
+ return; // wait for configuration to finish
44600
44605
  }
44601
44606
  else if (result.resultType === ResultType.BuildFromScratch) {
44602
44607
  // if (this._loadedFromPreset) { // start configuring when loading is done
@@ -44744,6 +44749,48 @@ class ThreedselectorComponent {
44744
44749
  this.loadConfigurator = true;
44745
44750
  }
44746
44751
  }
44752
+ async handleLoadIOneFurnitureIntoSceneByPreset(sku, instanceId, settings) {
44753
+ const toast = new Toast();
44754
+ toast.message = 'MODEL_LOADING';
44755
+ this._toastService.showToast(toast);
44756
+ const article = await this._loadFurnitureService.currentActiveService.loadArticle(sku);
44757
+ let position = this._bluePrintService.getCenter();
44758
+ const draggedData = {
44759
+ name: sku,
44760
+ constructFn: async (pos) => this.configureFurnitureFromPreset(sku, instanceId, settings),
44761
+ type: itemTypeFromPlacement(article.placement),
44762
+ iOne: true
44763
+ };
44764
+ this._messageBus.emit(MessageType.SetDrag, draggedData);
44765
+ this._messageBus.emit(MessageType.StartDrag, position);
44766
+ }
44767
+ async configureFurnitureFromPreset(sku, instanceId, settings) {
44768
+ this._resetConfigurator();
44769
+ this.firstBuild = true;
44770
+ const configuratorSettings = this._settingsService.settings.projectSettings ?
44771
+ this._settingsService.settings.projectSettings : this._settingsService.settings;
44772
+ const configuratorSettingsClone = Object.assign({}, configuratorSettings);
44773
+ const configuratorExternalSourceId = settings && settings.externalSourceId ? settings.externalSourceId : undefined;
44774
+ if (configuratorExternalSourceId) {
44775
+ configuratorSettingsClone.externalSourceId = configuratorExternalSourceId;
44776
+ configuratorSettingsClone.username = settings.username;
44777
+ configuratorSettingsClone.password = settings.password;
44778
+ configuratorSettingsClone.url = settings.url;
44779
+ configuratorSettingsClone.version = settings.version;
44780
+ configuratorSettingsClone.schema = settings.schema;
44781
+ configuratorSettingsClone.mainUrl = settings.url;
44782
+ configuratorSettingsClone.mainSchema = settings.schema;
44783
+ configuratorSettingsClone.mainVersion = settings.version;
44784
+ // Set here to just save it, when it comes back from the configurator, we need to add it to the metadata.
44785
+ this._externalSourceData = settings;
44786
+ }
44787
+ this._configuringService.scene = this._sceneService.scene;
44788
+ this._initConfigurator(configuratorSettingsClone, sku, !!configuratorExternalSourceId, instanceId);
44789
+ this._startPosition = this._bluePrintService.getCenter();
44790
+ this.loadConfigurator = true;
44791
+ this._changeDetector.detectChanges();
44792
+ return this._waitForBuildToFinish();
44793
+ }
44747
44794
  _initConfigurator(settings, sku, external, instanceId) {
44748
44795
  this.configuratorSettings = this._prepareSettings(settings, external);
44749
44796
  this.configuratorSku = sku;
@@ -44759,18 +44806,29 @@ class ThreedselectorComponent {
44759
44806
  }
44760
44807
  return settings;
44761
44808
  }
44762
- _resetConfigurator() {
44763
- this.currentMetadata = undefined;
44764
- this.configuratorSettings = undefined;
44765
- this.configuratorSku = undefined;
44766
- this.configuratorInstanceId = undefined;
44767
- this.loadConfigurator = false;
44809
+ _shouldResetConfigurator(result) {
44810
+ return result && result.resultType !== ResultType.NeedsUserInput;
44811
+ }
44812
+ _resetConfigurator(reset = true) {
44813
+ if (reset) {
44814
+ this.currentMetadata = undefined;
44815
+ this.configuratorSettings = undefined;
44816
+ this.configuratorSku = undefined;
44817
+ this.configuratorInstanceId = undefined;
44818
+ this.loadConfigurator = false;
44819
+ }
44768
44820
  this.firstBuild = false;
44769
44821
  }
44770
44822
  _waitForBuildToFinish() {
44771
44823
  return new Promise((resolve, reject) => {
44772
- this._configuratorEventService.buildFinished.pipe(filter$1(value => value !== undefined && value !== null), take(1)).subscribe((result) => {
44773
- this._resetConfigurator();
44824
+ this._configuratorEventService.buildFinished.pipe(filter$1(value => value !== undefined && value !== null), take$1(1)).subscribe((result) => {
44825
+ if (this._shouldResetConfigurator(result)) {
44826
+ this._resetConfigurator(true);
44827
+ }
44828
+ else {
44829
+ this._resetConfigurator(false);
44830
+ this._userActionNeeded = true;
44831
+ }
44774
44832
  resolve(this.handleBuildResult(result));
44775
44833
  });
44776
44834
  });
@@ -45465,6 +45523,7 @@ class ThreedselectorComponent {
45465
45523
  const type = itemTypeFromPlacement(result.placement);
45466
45524
  result.position = isFloorType(type) ? this._bluePrintService.getRoomCenter() : new Vector3();
45467
45525
  result.originalMetadata = {
45526
+ itemIdentifier: data.itemIdentifier,
45468
45527
  itemName: data.object.name,
45469
45528
  itemType: type,
45470
45529
  configurable: false,
@@ -45473,16 +45532,16 @@ class ThreedselectorComponent {
45473
45532
  // scale?: Vector3;
45474
45533
  // centerPivot?: boolean;
45475
45534
  thirdPartyModel: true,
45476
- // canElevate?: boolean;
45535
+ canElevate: data.stackable,
45477
45536
  // modelUrl?: string;
45478
- // scalable?: boolean;
45537
+ scalable: data.scalable,
45538
+ canScaleX: data.scalable,
45539
+ canScaleY: data.scalable,
45540
+ canScaleZ: data.scalable,
45479
45541
  // elevation?: number;
45480
45542
  // elevationFixed?: boolean;
45481
- // elevationAdjustable?: boolean;
45482
- canScaleX: true,
45483
- canScaleY: true,
45484
- canScaleZ: true,
45485
- colorable: true
45543
+ elevationAdjustable: data.heightAdjustable,
45544
+ colorable: data.colorable
45486
45545
  };
45487
45546
  this.handleBuildResult(result);
45488
45547
  }
@@ -48594,7 +48653,6 @@ class HomedecoratorComponent {
48594
48653
  [purchaseFilterOrders]="purchaseFilterOrders"
48595
48654
  [logisticsFilterOrders]="logisticsFilterOrders"
48596
48655
  ></rp-product-catalog>
48597
- <co-lite-selector></co-lite-selector>
48598
48656
  <rp-help></rp-help>
48599
48657
  </rp-loading-overlay>
48600
48658
  </div>
@@ -48613,7 +48671,7 @@ class HomedecoratorComponent {
48613
48671
  </div>
48614
48672
  }
48615
48673
  }
48616
- `, isInline: true, dependencies: [{ kind: "component", type: ProgressBarComponent, selector: "progress-bar" }, { kind: "component", type: LoadingOverlayComponent, selector: "rp-loading-overlay" }, { kind: "component", type: HdLoaderComponent, selector: "rp-loader", inputs: ["show"] }, { kind: "component", type: Core3dComponent, selector: "rp-core3d" }, { kind: "component", type: RoomPlannerComponent, selector: "rp-room-planner", inputs: ["isLoading"], outputs: ["done", "showPlugin", "focusControls"] }, { kind: "component", type: FurnitureManagerComponent, selector: "rp-furniture-manager" }, { kind: "component", type: PresetsComponent, selector: "rp-presets", inputs: ["openNewRoomDialog"] }, { kind: "component", type: ThreedselectorComponent, selector: "rp-threedselector", inputs: ["selections"], outputs: ["customizeButtonClicked"] }, { kind: "component", type: ToolbarComponent, selector: "rp-toolbar", inputs: ["shareButton"], outputs: ["externalSave", "externalOpen"] }, { kind: "component", type: ProductCatalogComponent, selector: "rp-product-catalog", inputs: ["generalFilterOrders", "purchaseFilterOrders", "logisticsFilterOrders"] }, { kind: "component", type: HelpComponent, selector: "rp-help" }, { kind: "component", type: i27.LiteSelectorComponent, selector: "co-lite-selector", inputs: ["show", "showLabel", "canClose", "animateSlideout", "customDimensions"], outputs: ["showChange", "answerChosen"] }], encapsulation: i0.ViewEncapsulation.None }); }
48674
+ `, isInline: true, dependencies: [{ kind: "component", type: ProgressBarComponent, selector: "progress-bar" }, { kind: "component", type: LoadingOverlayComponent, selector: "rp-loading-overlay" }, { kind: "component", type: HdLoaderComponent, selector: "rp-loader", inputs: ["show"] }, { kind: "component", type: Core3dComponent, selector: "rp-core3d" }, { kind: "component", type: RoomPlannerComponent, selector: "rp-room-planner", inputs: ["isLoading"], outputs: ["done", "showPlugin", "focusControls"] }, { kind: "component", type: FurnitureManagerComponent, selector: "rp-furniture-manager" }, { kind: "component", type: PresetsComponent, selector: "rp-presets", inputs: ["openNewRoomDialog"] }, { kind: "component", type: ThreedselectorComponent, selector: "rp-threedselector", inputs: ["selections"], outputs: ["customizeButtonClicked"] }, { kind: "component", type: ToolbarComponent, selector: "rp-toolbar", inputs: ["shareButton"], outputs: ["externalSave", "externalOpen"] }, { kind: "component", type: ProductCatalogComponent, selector: "rp-product-catalog", inputs: ["generalFilterOrders", "purchaseFilterOrders", "logisticsFilterOrders"] }, { kind: "component", type: HelpComponent, selector: "rp-help" }], encapsulation: i0.ViewEncapsulation.None }); }
48617
48675
  }
48618
48676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: HomedecoratorComponent, decorators: [{
48619
48677
  type: Component,
@@ -48640,7 +48698,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
48640
48698
  [purchaseFilterOrders]="purchaseFilterOrders"
48641
48699
  [logisticsFilterOrders]="logisticsFilterOrders"
48642
48700
  ></rp-product-catalog>
48643
- <co-lite-selector></co-lite-selector>
48644
48701
  <rp-help></rp-help>
48645
48702
  </rp-loading-overlay>
48646
48703
  </div>