@colijnit/homedecorator 258.1.11 → 258.1.13

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.
@@ -74,6 +74,7 @@ export declare class Item extends BaseItem {
74
74
  endDrag(): void;
75
75
  initObject(itemType: any, id: string, identifier: string, modelUrl: any): void;
76
76
  getHalfSize(): Vector3;
77
+ protected handleRawMetadata(): void;
77
78
  /** on is a bool */
78
79
  protected updateHighlight(): void;
79
80
  /** */
@@ -410,6 +410,7 @@ export declare abstract class WallItem extends Item {
410
410
  updateMaterialVisibility(side?: number): void;
411
411
  createTextureMaterial(options?: any): Promise<THREE.MeshPhongMaterial>;
412
412
  getTexture(): Texture;
413
+ setScaleXYZ(x: number, y: number, z: number, recalculateHalfSize?: boolean): void;
413
414
  protected createMaterial(side?: number, isSame?: boolean): Promise<void>;
414
415
  protected setYPositionBasedOnElevation(): void;
415
416
  protected addMaterialMap(material: THREE.MeshPhongMaterial, texture: Texture, flip: boolean): Promise<void>;
@@ -2487,46 +2487,9 @@
2487
2487
  _this.addChild(child);
2488
2488
  });
2489
2489
  }
2490
- if (rawMetadata && rawMetadata.scale != null) {
2491
- if (_this.canScaleX || _this.canScaleY || _this.canScaleZ) {
2492
- _this._shouldSetScale = true;
2493
- }
2494
- else {
2495
- _this.scaleGeometry(rawMetadata.scale.x, rawMetadata.scale.y, rawMetadata.scale.z);
2496
- }
2497
- }
2498
- if (_this.scalePercentage !== 100) {
2499
- _this.scale.set(_this.scalePercentage / 100, _this.scalePercentage / 100, _this.scalePercentage / 100);
2500
- }
2501
- _this.calculateHalfSize();
2502
2490
  if (_this.usePivot) {
2503
2491
  _this.updatePivot(_this.updatePivotOnCreate);
2504
2492
  }
2505
- if (rawMetadata) {
2506
- _this.initObject(rawMetadata.itemType, rawMetadata.itemId, rawMetadata.itemIdentifier, rawMetadata.modelUrl);
2507
- if (rawMetadata.position) {
2508
- _this.position.copy(rawMetadata.position);
2509
- _this.positionSet = true;
2510
- }
2511
- else {
2512
- _this.positionSet = false;
2513
- }
2514
- if (rawMetadata.elevation) {
2515
- _this.elevation = rawMetadata.elevation;
2516
- _this.setYPositionBasedOnElevation();
2517
- }
2518
- else {
2519
- _this.elevation = 0;
2520
- }
2521
- if (rawMetadata.rotation) {
2522
- if (rawMetadata.rotation instanceof THREE.Euler) {
2523
- _this.rotation.set(rawMetadata.rotation.x, rawMetadata.rotation.y, rawMetadata.rotation.z);
2524
- }
2525
- else {
2526
- _this.rotation.y = rawMetadata.rotation || 0;
2527
- }
2528
- }
2529
- }
2530
2493
  // this.add(new AxesHelper(2));
2531
2494
  _this._setOriginals();
2532
2495
  return _this;
@@ -2597,6 +2560,7 @@
2597
2560
  };
2598
2561
  Item.prototype.buildFinished = function () {
2599
2562
  _super.prototype.buildFinished.call(this);
2563
+ this.handleRawMetadata();
2600
2564
  // If it's possible to change materials then we need to store the original item
2601
2565
  // This way when we save the project we can do a diff on the materials and store
2602
2566
  // changes instead of the whole material
@@ -2606,9 +2570,6 @@
2606
2570
  }
2607
2571
  this.originalItem = ObjectUtils.DeepCloneObject3D(this);
2608
2572
  }
2609
- if (this._shouldSetScale) {
2610
- this.setScaleXYZ(this.rawMetadata.scale.x, this.rawMetadata.scale.y, this.rawMetadata.scale.z);
2611
- }
2612
2573
  };
2613
2574
  Item.prototype.connectorFromElement = function (selection) {
2614
2575
  var id = this._getIdentifierFromSelection(selection);
@@ -2741,6 +2702,47 @@
2741
2702
  Item.prototype.getHalfSize = function () {
2742
2703
  return this.halfSize.clone();
2743
2704
  };
2705
+ Item.prototype.handleRawMetadata = function () {
2706
+ var rawMetadata = this.rawMetadata;
2707
+ if (rawMetadata) {
2708
+ this.initObject(rawMetadata.itemType, rawMetadata.itemId, rawMetadata.itemIdentifier, rawMetadata.modelUrl);
2709
+ if (rawMetadata.rotation) {
2710
+ if (rawMetadata.rotation instanceof THREE.Euler) {
2711
+ this.rotation.set(rawMetadata.rotation.x, rawMetadata.rotation.y, rawMetadata.rotation.z);
2712
+ }
2713
+ else {
2714
+ this.rotation.y = rawMetadata.rotation || 0;
2715
+ }
2716
+ }
2717
+ if (rawMetadata.position) {
2718
+ this.position.copy(rawMetadata.position);
2719
+ this.positionSet = true;
2720
+ }
2721
+ else {
2722
+ this.positionSet = false;
2723
+ }
2724
+ if (rawMetadata.scale) {
2725
+ if (this.canScaleX || this.canScaleY || this.canScaleZ) {
2726
+ this.setScaleXYZ(this.rawMetadata.scale.x, this.rawMetadata.scale.y, this.rawMetadata.scale.z);
2727
+ // this._shouldSetScale = true;
2728
+ }
2729
+ else {
2730
+ this.scaleGeometry(rawMetadata.scale.x, rawMetadata.scale.y, rawMetadata.scale.z);
2731
+ }
2732
+ }
2733
+ if (this.scalePercentage !== 100) {
2734
+ this.scale.set(this.scalePercentage / 100, this.scalePercentage / 100, this.scalePercentage / 100);
2735
+ }
2736
+ if (rawMetadata.elevation) {
2737
+ this.elevation = rawMetadata.elevation;
2738
+ this.setYPositionBasedOnElevation();
2739
+ }
2740
+ else {
2741
+ this.elevation = 0;
2742
+ }
2743
+ }
2744
+ this.calculateHalfSize();
2745
+ };
2744
2746
  /** on is a bool */
2745
2747
  Item.prototype.updateHighlight = function () {
2746
2748
  if (this.highLightDisabled) {
@@ -14030,6 +14032,11 @@
14030
14032
  WallItem.prototype.getTexture = function () {
14031
14033
  return this.texture;
14032
14034
  };
14035
+ WallItem.prototype.setScaleXYZ = function (x, y, z, recalculateHalfSize) {
14036
+ if (recalculateHalfSize === void 0) { recalculateHalfSize = true; }
14037
+ _super_1.prototype.setScaleXYZ.call(this, x, y, z, recalculateHalfSize);
14038
+ this.reposition();
14039
+ };
14033
14040
  WallItem.prototype.createMaterial = function (side, isSame) {
14034
14041
  if (side === void 0) { side = THREE__namespace.DoubleSide; }
14035
14042
  if (isSame === void 0) { isSame = true; }
@@ -14207,6 +14214,9 @@
14207
14214
  /** takes the move vec3, and makes sure object stays bounded on plane */
14208
14215
  WallItem.prototype._boundMove = function (vec3) {
14209
14216
  var edge = this.currentWallEdge;
14217
+ if (!edge) {
14218
+ return;
14219
+ }
14210
14220
  vec3.applyMatrix4(edge.interiorTransform);
14211
14221
  edge.wall.itemsChanged = true;
14212
14222
  if (vec3.x < this._sizeX / 2.0 + this._positionYTolerance) {
@@ -15485,6 +15495,7 @@
15485
15495
  item.opening = Object.assign({}, metadata.opening);
15486
15496
  }
15487
15497
  item.userData.itemType = metadata.itemType;
15498
+ item.buildFinished();
15488
15499
  this.addItem(item);
15489
15500
  return item;
15490
15501
  };
@@ -15522,6 +15533,7 @@
15522
15533
  return [4 /*yield*/, new itemConstructor(metadata, modelData.object)];
15523
15534
  case 1:
15524
15535
  item = _a.sent();
15536
+ item.buildFinished();
15525
15537
  this.addItem(item);
15526
15538
  return [2 /*return*/, item];
15527
15539
  }
@@ -23011,7 +23023,7 @@
23011
23023
  var height = new BoxMeasurement();
23012
23024
  var heightString = MeasurementUtils.makeText(this._height, this.dimUnit, this.distanceStep);
23013
23025
  var text = this._dictionaryService.get('LABEL_HEIGHT');
23014
- height.textMesh = makeTextMesh(heightString, this._font, text);
23026
+ height.textMesh = makeTextMesh(heightString, this._font, 0xFF00FF, 0.08, false, false, text);
23015
23027
  height.positions = this.calculateHeightPositions();
23016
23028
  return height;
23017
23029
  };
@@ -23028,7 +23040,7 @@
23028
23040
  var width = new BoxMeasurement();
23029
23041
  var widthString = MeasurementUtils.makeText(this._width, this.dimUnit, this.distanceStep);
23030
23042
  var text = this._dictionaryService.get('LABEL_WIDTH');
23031
- width.textMesh = makeTextMesh(widthString, this._font, text);
23043
+ width.textMesh = makeTextMesh(widthString, this._font, 0xFF00FF, 0.08, false, false, text);
23032
23044
  width.positions = this.calculateWidthPositions();
23033
23045
  return width;
23034
23046
  };
@@ -23045,7 +23057,7 @@
23045
23057
  var openingDepth = new BoxMeasurement();
23046
23058
  var openingDepthString = MeasurementUtils.makeText(this._openingDepth, this.dimUnit, this.distanceStep);
23047
23059
  var text = this._dictionaryService.get('LABEL_DEPTH');
23048
- openingDepth.textMesh = makeTextMesh(openingDepthString, this._font, text);
23060
+ openingDepth.textMesh = makeTextMesh(openingDepthString, this._font, 0xFF00FF, 0.08, false, false, text);
23049
23061
  openingDepth.positions = this.calculateOpeningDepthPositions();
23050
23062
  return openingDepth;
23051
23063
  };
@@ -33104,6 +33116,7 @@
33104
33116
  }
33105
33117
  item.allowRotate = true;
33106
33118
  item.highLightDisabled = !this._settingsService.settings.options.useStandaloneHighLight;
33119
+ item.buildFinished();
33107
33120
  newCustomFloorObj.furniture = item;
33108
33121
  return newCustomFloorObj;
33109
33122
  };