hart-estate-widget 0.0.26 → 0.0.29

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.
@@ -111,8 +111,8 @@ const setPanoramaLinks = (json, currentRoom, center, panorama, panoramas) => {
111
111
  return room_id === connectedRoom.ID;
112
112
  });
113
113
  if (!connectedPanorama) return;
114
- const locationX = Location.X - center[0];
115
- const locationY = -(Location.Y - center[1]);
114
+ const locationX = Location.Y - center[1];
115
+ const locationY = Location.X - center[0];
116
116
  const defaultScale = 20;
117
117
  const maxScale = 50;
118
118
  const defaultLength = 120;
@@ -222,6 +222,7 @@ const PanoramaTab = _ref3 => {
222
222
  });
223
223
  newViewer.add(panorama);
224
224
  });
225
+ newViewer.scene.rotation.y = Math.PI / 2;
225
226
  setViewer(newViewer);
226
227
  initPanorama();
227
228
  }, [panoramas]);
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  require("core-js/modules/es.promise.js");
9
9
 
10
- require("core-js/modules/es.array.reduce.js");
11
-
12
10
  var _react = _interopRequireDefault(require("react"));
13
11
 
14
12
  var _mobx = require("mobx");
@@ -25,9 +23,8 @@ class ApiStore {
25
23
  constructor(API_URL) {
26
24
  _defineProperty(this, "API_URL", null);
27
25
 
28
- _defineProperty(this, "loadFurnitureData", async furniture => {
29
- const furnitureQuery = furniture.reduce((acc, item, i) => acc += "".concat(i === 0 ? '' : ',').concat(item.Model), '');
30
- const path = "".concat(this.API_URL, "/api/furniture?only=").concat(furnitureQuery);
26
+ _defineProperty(this, "loadFurnitureData", async () => {
27
+ const path = "".concat(this.API_URL, "/api/furniture");
31
28
  const response = await fetch(path);
32
29
  return await response.json();
33
30
  });
@@ -101,7 +101,7 @@ class HouseStore {
101
101
 
102
102
  _defineProperty(this, "clippingPlanes", []);
103
103
 
104
- _defineProperty(this, "furnitureData", {});
104
+ _defineProperty(this, "furnitureData", []);
105
105
 
106
106
  _defineProperty(this, "loadedModels", {});
107
107
 
@@ -117,7 +117,7 @@ class HouseStore {
117
117
  this.setCenterPosition().loadTextures().then(() => {
118
118
  this.createFloors().createSpaceBetweenWalls().createWalls().createDoors();
119
119
  });
120
- this.apiStore.loadFurnitureData(this.furniture).then(resp => {
120
+ this.apiStore.loadFurnitureData().then(resp => {
121
121
  this.furnitureData = resp;
122
122
  this.loadFurniture(0);
123
123
  });
@@ -618,7 +618,13 @@ class HouseStore {
618
618
  loadFurniture(index) {
619
619
  const furniture = this.furniture[index];
620
620
  if (!furniture) return;
621
- const furnitureData = this.furnitureData[furniture.Model];
621
+ const furnitureData = this.furnitureData.find(_ref12 => {
622
+ let {
623
+ name,
624
+ type
625
+ } = _ref12;
626
+ return name === furniture.Model && type === furniture.Type;
627
+ });
622
628
 
623
629
  if (!furnitureData) {
624
630
  this.loadFurniture(index + 1);
@@ -632,7 +638,7 @@ class HouseStore {
632
638
  const modelPath = "".concat(this.apiStore.API_URL, "/storage/furniture/").concat(mesh);
633
639
  const {
634
640
  Location,
635
- WEB_Rotation,
641
+ Rotation,
636
642
  Model: ModelName
637
643
  } = furniture;
638
644
  const {
@@ -648,31 +654,31 @@ class HouseStore {
648
654
  });
649
655
 
650
656
  const onTexturesLoaded = (result, model) => {
651
- const materialsCount = result.reduce((acc, _ref12) => {
657
+ const materialsCount = result.reduce((acc, _ref13) => {
652
658
  let {
653
659
  image
654
- } = _ref12;
660
+ } = _ref13;
655
661
  if (!image.currentSrc.includes('_D.') && !image.currentSrc.includes('_DA.')) return acc;
656
662
  return acc += 1;
657
663
  }, 0);
658
664
 
659
665
  const createMaterial = num => {
660
- const map = result.find(_ref13 => {
666
+ const map = result.find(_ref14 => {
661
667
  let {
662
668
  image
663
- } = _ref13;
669
+ } = _ref14;
664
670
  return image.currentSrc.includes("".concat(num, "_D.")) || image.currentSrc.includes("".concat(num, "_DA."));
665
671
  });
666
- const envMap = result.find(_ref14 => {
672
+ const envMap = result.find(_ref15 => {
667
673
  let {
668
674
  image
669
- } = _ref14;
675
+ } = _ref15;
670
676
  return image.currentSrc.includes("".concat(num, "_RMO."));
671
677
  });
672
- const normalMap = result.find(_ref15 => {
678
+ const normalMap = result.find(_ref16 => {
673
679
  let {
674
680
  image
675
- } = _ref15;
681
+ } = _ref16;
676
682
  return image.currentSrc.includes("".concat(num, "_N."));
677
683
  });
678
684
  const material = new THREE.MeshStandardMaterial({
@@ -721,7 +727,7 @@ class HouseStore {
721
727
  const model = originalModel.clone();
722
728
  model.scale.set(this.sceneScale, this.sceneScale, this.sceneScale);
723
729
  model.position.set(X * this.sceneScale, Y * this.sceneScale, Z * this.sceneScale);
724
- model.rotation.set(Math.PI / 2, THREE.Math.degToRad(WEB_Rotation.Yaw), 0);
730
+ model.rotation.set(Math.PI / 2, THREE.Math.degToRad(Rotation.Yaw), 0);
725
731
  const loadedTextures = this.loadedTextures[ModelName];
726
732
 
727
733
  if (loadedTextures) {
@@ -766,11 +772,11 @@ class HouseStore {
766
772
 
767
773
  setCurrentWallsMaterialType(value) {
768
774
  this.wallsMaterialType = value;
769
- this.wallsGroup.children.forEach(_ref16 => {
775
+ this.wallsGroup.children.forEach(_ref17 => {
770
776
  let {
771
777
  children,
772
778
  isExterior
773
- } = _ref16;
779
+ } = _ref17;
774
780
  const wall = children[0];
775
781
 
776
782
  if (value === 'texture') {
@@ -796,11 +802,11 @@ class HouseStore {
796
802
  setCurrentWallColor(color) {
797
803
  this.wallsColor = color;
798
804
  this.wallsMaterial.color.set(color);
799
- this.wallsGroup.children.forEach(_ref17 => {
805
+ this.wallsGroup.children.forEach(_ref18 => {
800
806
  let {
801
807
  children,
802
808
  isExterior
803
- } = _ref17;
809
+ } = _ref18;
804
810
  if (isExterior) return;
805
811
  const wall = children[0];
806
812
  wall.material.color.set(color);
@@ -827,10 +833,10 @@ class HouseStore {
827
833
  setFullBuildingVisibility(value) {
828
834
  this.isFullBuildingVisible = value;
829
835
  this.globalPlane.constant = this.isFullBuildingVisible ? 1 : clippedBuildingConstant;
830
- this.wallsGroup.children.forEach(_ref18 => {
836
+ this.wallsGroup.children.forEach(_ref19 => {
831
837
  let {
832
838
  children
833
- } = _ref18;
839
+ } = _ref19;
834
840
  return children[2].visible = !value;
835
841
  });
836
842
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "HART Estate widget",
4
4
  "author": "HART",
5
5
  "keywords": [],
6
- "version": "0.0.26",
6
+ "version": "0.0.29",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",