@colijnit/configurator 260.1.1 → 260.1.2

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.
@@ -2273,7 +2273,9 @@
2273
2273
  var materialToSearch = !!variation.materialId ? variation.materialId.toLowerCase() : 'default';
2274
2274
  if (Array.isArray(mesh.material)) { // multimaterial support
2275
2275
  for (var m = 0, mlen = mesh.material.length; m < mlen; m++) {
2276
- if (mesh.material[m].name.toLowerCase().indexOf(materialToSearch) !== -1) {
2276
+ // if (mesh.material[m].name.toLowerCase().indexOf(materialToSearch) !== -1) {
2277
+ if ((variation.materialId && mesh.material[m].name.toLowerCase() === materialToSearch) ||
2278
+ (!variation.materialId && mesh.material[m].name.toLowerCase().indexOf(materialToSearch) !== -1)) {
2277
2279
  if ((variation.material instanceof Material || variation.material.constructor.name === 'Material') && variation.material.isMaterial) {
2278
2280
  // it's a THREE.Material
2279
2281
  mesh.material[m] = variation.material;
@@ -2291,7 +2293,9 @@
2291
2293
  }
2292
2294
  }
2293
2295
  else {
2294
- if (mesh.material.name && mesh.material.name.toLowerCase().indexOf(materialToSearch) !== -1) {
2296
+ // if (mesh.material.name && mesh.material.name.toLowerCase().indexOf(materialToSearch) !== -1) {
2297
+ if ((variation.materialId && mesh.material.name.toLowerCase() === materialToSearch) ||
2298
+ (!variation.materialId && mesh.material.name.toLowerCase().indexOf(materialToSearch) !== -1)) {
2295
2299
  if ((variation.material instanceof Material || variation.material.constructor.name === 'Material') && variation.material.isMaterial) {
2296
2300
  // it's a THREE.Material
2297
2301
  mesh.material = variation.material;
@@ -3193,11 +3197,11 @@
3193
3197
  selectionOfArticle.gameObject &&
3194
3198
  selectionOfArticle.gameObject.length > 0;
3195
3199
  // get generic variations
3196
- var globalVariations = this._selections
3197
- .filter(function (s) { return (s.generic || adjustableSelections.length === 1) && s.decoNode.variation && !s.decoNode.type; })
3200
+ var globalVariations = selections
3201
+ .filter(function (s) { return (s.generic || adjustableSelections.length === 1) && s.decoNode.variation; } /*&& !s.decoNode.type*/)
3198
3202
  .map(function (value, index, array) {
3199
3203
  // find selection of variation
3200
- var sel = _this._selections.find(function (s) { return s.artNodeIdDeco === value.decoNode.variation.parentId; });
3204
+ var sel = selections.find(function (s) { return s.artNodeIdDeco === value.decoNode.variation.parentId; });
3201
3205
  if (sel) {
3202
3206
  value.decoNode.variation.supplierArticleNr = sel.supplierArticleNr;
3203
3207
  }
@@ -3226,7 +3230,7 @@
3226
3230
  var previousPresLevel = -1;
3227
3231
  var positioning;
3228
3232
  var optionText;
3229
- var _loop_1 = function (i) {
3233
+ for (var i = 0; i < len; i++) {
3230
3234
  var selection = selections[i];
3231
3235
  if (selection.presentationLevel === 1) {
3232
3236
  positioning = selection.hdecoPositioning;
@@ -3237,33 +3241,33 @@
3237
3241
  }
3238
3242
  if (selection.decoNode) {
3239
3243
  if (selection.decoNode.type === decoNodeType_enum.DecoNodeType.Variation) {
3240
- var decoNode_1 = selection.decoNode;
3241
- decoNode_1.optionText = optionText;
3244
+ var decoNode = selection.decoNode;
3245
+ decoNode.optionText = optionText;
3242
3246
  // find selection of variation and set materialId in case of multimaterial
3243
- decoNode_1.materialId = this_1._getMaterialIdFromParent(decoNode_1.nodeId);
3247
+ decoNode.materialId = this._getMaterialIdFromParent(decoNode.nodeId);
3244
3248
  if (lastAdded) {
3245
3249
  if (newPart) {
3246
- if (decoNode_1.materialId) {
3247
- lastAdded.variations.push(decoNode_1);
3250
+ if (decoNode.materialId) {
3251
+ lastAdded.variations.push(decoNode);
3248
3252
  }
3249
3253
  else {
3250
- lastAdded.variations = [decoNode_1];
3254
+ lastAdded.variations = [decoNode];
3251
3255
  }
3252
3256
  }
3253
3257
  else {
3254
- lastAdded.variations.push(decoNode_1);
3258
+ lastAdded.variations.push(decoNode);
3255
3259
  }
3256
3260
  newPart = false;
3257
3261
  }
3258
- else {
3259
- if (globalVariationsRewrite) {
3260
- globalVariations.length = 0;
3261
- globalVariationsRewrite = false;
3262
- }
3263
- if (!globalVariations.find(function (v) { return v.id === decoNode_1.id; })) {
3264
- globalVariations.push(decoNode_1);
3265
- }
3266
- }
3262
+ // else {
3263
+ // if (globalVariationsRewrite) {
3264
+ // globalVariations.length = 0;
3265
+ // globalVariationsRewrite = false;
3266
+ // }
3267
+ // if (!globalVariations.find(v => v.id === decoNode.id)) {
3268
+ // globalVariations.push(decoNode);
3269
+ // }
3270
+ // }
3267
3271
  // const variation: FurniturePartVariation = new FurniturePartVariation();
3268
3272
  // variation.BrandId = selection.decoNode.brandId;
3269
3273
  // variation.Description = selection.decoNode.gameObjectName;
@@ -3276,7 +3280,7 @@
3276
3280
  selection.decoNode.gameObjectName.length) || (isArticleWithMaterial)) {
3277
3281
  if (selection.decoNode.kind === decoNodeKind_enum.DecoNodeKind.Adjustable || (isArticleWithMaterial)) {
3278
3282
  selection.variations = globalVariations;
3279
- this_1._adjustables.push(selection);
3283
+ this._adjustables.push(selection);
3280
3284
  if (!lastAdded || (lastAdded.nodeId !== selection.nodeId || lastAdded.node !== selection.node)) {
3281
3285
  newPart = true;
3282
3286
  }
@@ -3288,7 +3292,7 @@
3288
3292
  if (lastAdjustable) {
3289
3293
  lastAdjustable.addables.push(selection);
3290
3294
  }
3291
- this_1._addables.push(selection);
3295
+ this._addables.push(selection);
3292
3296
  if (!lastAdded || (lastAdded.nodeId !== selection.nodeId || lastAdded.node !== selection.node)) {
3293
3297
  newPart = true;
3294
3298
  }
@@ -3297,10 +3301,6 @@
3297
3301
  }
3298
3302
  }
3299
3303
  previousPresLevel = selection.presentationLevel;
3300
- };
3301
- var this_1 = this;
3302
- for (var i = 0; i < len; i++) {
3303
- _loop_1(i);
3304
3304
  }
3305
3305
  // this._upsertFurniture(this.activeInstance,
3306
3306
  // {Variations: usedVariations});
@@ -3508,23 +3508,23 @@
3508
3508
  return;
3509
3509
  }
3510
3510
  var len = this._selections.length;
3511
- var _loop_2 = function (i) {
3511
+ var _loop_1 = function (i) {
3512
3512
  // const id: string = this.selections[i].artNodeIdDeco;
3513
- var deco = this_2._decos.find(function (d) { return d.nodeId === _this._selections[i].node; });
3513
+ var deco = this_1._decos.find(function (d) { return d.nodeId === _this._selections[i].node; });
3514
3514
  if (!deco) {
3515
3515
  deco = new decoNode.DecoNode();
3516
3516
  }
3517
3517
  if (deco.type !== decoNodeType_enum.DecoNodeType.Variation) {
3518
- var variation = this_2._getVariations().find(function (v) { return v.parentId === _this._selections[i].artNodeIdDeco; });
3518
+ var variation = this_1._getVariations().find(function (v) { return v.parentId === _this._selections[i].artNodeIdDeco; });
3519
3519
  if (variation) {
3520
3520
  deco.variation = variation;
3521
3521
  }
3522
3522
  }
3523
- this_2._selections[i].decoNode = deco;
3523
+ this_1._selections[i].decoNode = deco;
3524
3524
  };
3525
- var this_2 = this;
3525
+ var this_1 = this;
3526
3526
  for (var i = 0; i < len; i++) {
3527
- _loop_2(i);
3527
+ _loop_1(i);
3528
3528
  }
3529
3529
  };
3530
3530
  Builder.prototype._getVariations = function () {