door_models 5.4.1 → 5.4.3

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.
package/dist/index.esm.js CHANGED
@@ -75,8 +75,7 @@ const ConfiguratorProvider = _ref => {
75
75
  let {
76
76
  children,
77
77
  initialIs2D = false,
78
- initialMaterials = {},
79
- totalDepth
78
+ initialMaterials = {}
80
79
  } = _ref;
81
80
  const [materials, setMaterials] = useState(initialMaterials);
82
81
  const [is2D, setIs2D] = useState(initialIs2D);
@@ -573,35 +572,13 @@ const ConfiguratorProvider = _ref => {
573
572
  };
574
573
  break;
575
574
  }
576
- const baseTotalDepth = 103; // Define the reference depth for scaling (103mm is a common default)
577
- const scaleFactor = totalDepth !== undefined && baseTotalDepth > 0 ? totalDepth / baseTotalDepth : 1;
578
-
579
- // Apply the scaling factor to all depth-related settings
580
- if (scaleFactor !== 1) {
581
- if (newSettings.frameDepth !== undefined) newSettings.frameDepth *= scaleFactor;
582
- if (newSettings.doorDepth !== undefined) newSettings.doorDepth *= scaleFactor;
583
- if (newSettings.doorStopDepth !== undefined) newSettings.doorStopDepth *= scaleFactor;
584
- if (newSettings.secondDoorStopDepth !== undefined) newSettings.secondDoorStopDepth *= scaleFactor;
585
- if (newSettings.gasketDepth !== undefined) newSettings.gasketDepth *= scaleFactor;
586
-
587
- // Handle string-based depths like "40mm" for notchDepth
588
- if (typeof newSettings.notchDepth === "string") {
589
- const num = parseInt(newSettings.notchDepth, 10);
590
- if (!isNaN(num)) {
591
- newSettings.notchDepth = "".concat(num * scaleFactor, "mm");
592
- }
593
- }
594
- }
595
575
  const isMxCaf = frameType.startsWith("MXCAF");
596
576
  setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
597
- visible: isMxCaf,
598
- depth: 12 * scaleFactor
577
+ visible: isMxCaf
599
578
  }));
600
579
  setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
601
- visible: isMxCaf,
602
- depth: 12 * scaleFactor
580
+ visible: isMxCaf
603
581
  }));
604
- setGlassDepth(8 * scaleFactor);
605
582
  const {
606
583
  doorDepth
607
584
  } = newSettings,
@@ -612,7 +589,7 @@ const ConfiguratorProvider = _ref => {
612
589
  theDoorDepth: doorDepth
613
590
  }));
614
591
  }
615
- }, [frameType, totalDepth]);
592
+ }, [frameType]);
616
593
 
617
594
  // --- Exterior Fanlight Logic ---
618
595
  useEffect(() => {
@@ -722,74 +699,61 @@ const useConfigurator = () => {
722
699
 
723
700
  const availableMaterials = {
724
701
  black: new THREE.MeshStandardMaterial({
725
- color: "#000000",
726
- side: THREE.DoubleSide
702
+ color: "#000000"
727
703
  }),
728
704
  metal: new THREE.MeshStandardMaterial({
729
705
  color: "#aaaaaa",
730
706
  metalness: 1.0,
731
- roughness: 0.4,
732
- side: THREE.DoubleSide
707
+ roughness: 0.4
733
708
  }),
734
709
  darkgrey: new THREE.MeshStandardMaterial({
735
- color: "#5e5e5e",
736
- side: THREE.DoubleSide
710
+ color: "#5e5e5e"
737
711
  }),
738
712
  grey: new THREE.MeshStandardMaterial({
739
- color: "#cccccc",
740
- side: THREE.DoubleSide
713
+ color: "#cccccc"
741
714
  }),
742
715
  yellow: new THREE.MeshStandardMaterial({
743
- color: "#ffff00",
744
- side: THREE.DoubleSide
716
+ color: "#ffff00"
745
717
  }),
746
718
  darkBrown: new THREE.MeshStandardMaterial({
747
- color: "#a0522d",
748
- side: THREE.DoubleSide
719
+ color: "#a0522d"
749
720
  }),
750
721
  brown: new THREE.MeshStandardMaterial({
751
- color: "#d2b48c",
752
- side: THREE.DoubleSide
722
+ color: "#d2b48c"
753
723
  }),
754
724
  glass: new THREE.MeshStandardMaterial({
755
725
  color: "#ffffff",
756
726
  roughness: 0.1,
757
727
  transparent: true,
758
- opacity: 0.7,
759
- side: THREE.DoubleSide
728
+ opacity: 0.7
760
729
  }),
761
730
  aluminum: new THREE.MeshStandardMaterial({
762
731
  color: "#abb0aa",
763
732
  metalness: 0.8,
764
733
  roughness: 0.5,
765
- envMapIntensity: 1.2,
766
- side: THREE.DoubleSide
734
+ envMapIntensity: 1.2
767
735
  }),
768
736
  aluminumBrighter: new THREE.MeshStandardMaterial({
769
737
  color: "#cdcdcd",
770
738
  metalness: 0.8,
771
739
  roughness: 0.5,
772
- envMapIntensity: 1.2,
773
- side: THREE.DoubleSide
740
+ envMapIntensity: 1.2
774
741
  }),
775
742
  aluminumExtraBrighter: new THREE.MeshStandardMaterial({
776
743
  color: "#ececec",
777
744
  metalness: 0.8,
778
745
  roughness: 0.5,
779
- envMapIntensity: 1.2,
780
- side: THREE.DoubleSide
746
+ envMapIntensity: 1.2
781
747
  }),
782
748
  silver: new THREE.MeshStandardMaterial({
783
749
  color: "#c0c0c0",
784
750
  metalness: 1.0,
785
- roughness: 0.2,
786
- side: THREE.DoubleSide
751
+ roughness: 0.2
787
752
  }),
788
753
  gold: new THREE.MeshStandardMaterial({
789
754
  color: "#ffd700",
790
755
  metalness: 1.0,
791
- roughness: 0.3,
792
- side: THREE.DoubleSide
756
+ roughness: 0.3
793
757
  }),
794
758
  diamond: new THREE.MeshStandardMaterial({
795
759
  color: "#e0f7fa",
@@ -797,24 +761,20 @@ const availableMaterials = {
797
761
  roughness: 0.05,
798
762
  transparent: true,
799
763
  opacity: 0.9,
800
- envMapIntensity: 1.5,
801
- side: THREE.DoubleSide
764
+ envMapIntensity: 1.5
802
765
  }),
803
766
  test_material: new THREE.MeshStandardMaterial({
804
767
  color: "red",
805
- roughness: 0.1,
806
- side: THREE.DoubleSide
768
+ roughness: 0.1
807
769
  })
808
770
  };
809
771
  new THREE.MeshStandardMaterial({
810
772
  color: "#cccccc",
811
- roughness: 0.8,
812
- side: THREE.DoubleSide
773
+ roughness: 0.8
813
774
  });
814
775
  new THREE.MeshStandardMaterial({
815
776
  color: "#000",
816
- roughness: 0.8,
817
- side: THREE.DoubleSide
777
+ roughness: 0.8
818
778
  });
819
779
 
820
780
  // Helper function to check for hex color codes
@@ -822,7 +782,7 @@ const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
822
782
 
823
783
  /**
824
784
  * A simple "builder" that creates a THREE.MeshStandardMaterial from a prop and an
825
- * optional map of pre-loaded textures. It does NOT load textures itself.
785
+ * optional map of pre-loaded textures. It now loads textures if they are not pre-loaded.
826
786
  * @param prop - The material definition (string or object).
827
787
  * @param textures - A map of URL -> THREE.Texture, provided by useTexture.
828
788
  * @returns A THREE.MeshStandardMaterial instance.
@@ -845,7 +805,8 @@ const buildMaterial = (prop, textures) => {
845
805
  } else if (textures && textures[sourceValue]) {
846
806
  params.map = textures[sourceValue];
847
807
  } else {
848
- params.color = "yellow";
808
+ const texture = new THREE.TextureLoader().load(sourceValue);
809
+ params.map = texture;
849
810
  }
850
811
  if (opacity !== undefined && opacity < 1) {
851
812
  params.transparent = true;
@@ -2284,24 +2245,20 @@ const DoorConfigurator = _ref => {
2284
2245
  is2D = false,
2285
2246
  totalWidth,
2286
2247
  totalHeight,
2287
- totalDepth // Destructure the new prop
2248
+ frameDepth
2288
2249
  } = _ref;
2289
- return (
2290
- /*#__PURE__*/
2291
- // Pass the totalDepth prop to the Provider
2292
- jsx(ConfiguratorProvider, {
2293
- initialIs2D: is2D,
2294
- totalDepth: totalDepth,
2295
- children: /*#__PURE__*/jsx(DoorModels, {
2296
- doorName: doorName,
2297
- materials: materials,
2298
- doorPivot: doorPivot,
2299
- doorOpening: doorOpening,
2300
- totalWidth: totalWidth,
2301
- totalHeight: totalHeight
2302
- })
2250
+ return /*#__PURE__*/jsx(ConfiguratorProvider, {
2251
+ initialIs2D: is2D,
2252
+ children: /*#__PURE__*/jsx(DoorModels, {
2253
+ doorName: doorName,
2254
+ materials: materials,
2255
+ doorPivot: doorPivot,
2256
+ doorOpening: doorOpening,
2257
+ totalWidth: totalWidth,
2258
+ totalHeight: totalHeight,
2259
+ frameDepth: frameDepth
2303
2260
  })
2304
- );
2261
+ });
2305
2262
  };
2306
2263
 
2307
2264
  export { DoorConfigurator as default, useConfigurator };