@smarterplan/ngx-smarterplan-core 1.2.37 → 1.2.39

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.
@@ -3336,7 +3336,17 @@ class MatterportService {
3336
3336
  this.dictionnaryObjects3D.get(uuid).obj3D.visible = false;
3337
3337
  }
3338
3338
  getObject3DModelNodeFromDictionnary(uuid) {
3339
- return this.dictionnaryObjects3D.get(uuid);
3339
+ let obj = this.dictionnaryObjects3D.get(uuid);
3340
+ if (!obj) {
3341
+ console.log("weird thing again");
3342
+ return null;
3343
+ }
3344
+ //might break things or fix everything ..?
3345
+ if (obj.obj3D.uuid != uuid) {
3346
+ console.log("we have THE problem");
3347
+ obj.obj3D.uuid = uuid; //not enugh to fix the pb
3348
+ }
3349
+ return obj;
3340
3350
  }
3341
3351
  /**
3342
3352
  * Creates MattertagData and start repositioning (creates temporary mattertag that follows the cursor)
@@ -3848,7 +3858,7 @@ class MatterportService {
3848
3858
  // By defaut, during creation, object has translation gizmo
3849
3859
  // => User has to click on lateral panel, and save its position after playing with it!
3850
3860
  if (mode && !isNestThermostat) {
3851
- this.attachGizmoControlTo3DObject(modelNode, sceneObject, mode, true).catch((e) => console.log(e));
3861
+ this.attachGizmoControlTo3DObject(modelNode, sceneObject, mode, true, true).catch((e) => console.log(e));
3852
3862
  }
3853
3863
  if (this.lastObject3D && typeof this.lastObject3D.id === 'string') {
3854
3864
  // prompt ThreeJS UUID to match our last generated object if new (not from Db)
@@ -3987,7 +3997,7 @@ class MatterportService {
3987
3997
  this.azimuthalCrown.obj3D.position.set(this.poseCamera.position.x, this.poseCamera.position.y, this.poseCamera.position.z);
3988
3998
  }
3989
3999
  }
3990
- async attachGizmoControlTo3DObject(modelNode, sceneObject, mode, visible) {
4000
+ async attachGizmoControlTo3DObject(modelNode, sceneObject, mode, visible, isNewObject) {
3991
4001
  // Create a scene node with a transform control component.
3992
4002
  let node = null;
3993
4003
  node = sceneObject.addNode();
@@ -4007,13 +4017,21 @@ class MatterportService {
4007
4017
  // // set 'translate' mode to position the selection.
4008
4018
  myControl.inputs.mode = mode;
4009
4019
  modelNode.obj3D.controls = myControl; // store gizmoCtrl inside object
4010
- if (!this.lastObject3D || !this.lastObject3D.controls) {
4011
- try {
4012
- modelNode.obj3D.uuid = this.lastObject3D.uuid || this.lastObject3D.id;
4013
- }
4014
- catch (e) {
4015
- console.log(`id obj in Scene was not assigned to id from DB since`);
4020
+ if (isNewObject) { //i keep the current solution for new objects
4021
+ if (!this.lastObject3D || !this.lastObject3D.controls) {
4022
+ try {
4023
+ modelNode.obj3D.uuid = this.lastObject3D.uuid || this.lastObject3D.id;
4024
+ }
4025
+ catch (e) {
4026
+ console.log(`id obj in Scene was not assigned to id from DB since`);
4027
+ }
4028
+ this.lastObject3D = modelNode.obj3D;
4016
4029
  }
4030
+ }
4031
+ else { //objects already in place have to become the "lastObject" (i think?)
4032
+ console.log("in my solution !");
4033
+ console.log(modelNode);
4034
+ console.log(modelNode.obj3D.uuid);
4017
4035
  this.lastObject3D = modelNode.obj3D;
4018
4036
  }
4019
4037
  return modelNode;