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.cjs.js CHANGED
@@ -102,8 +102,7 @@ const ConfiguratorProvider = _ref => {
102
102
  let {
103
103
  children,
104
104
  initialIs2D = false,
105
- initialMaterials = {},
106
- totalDepth
105
+ initialMaterials = {}
107
106
  } = _ref;
108
107
  const [materials, setMaterials] = React.useState(initialMaterials);
109
108
  const [is2D, setIs2D] = React.useState(initialIs2D);
@@ -600,35 +599,13 @@ const ConfiguratorProvider = _ref => {
600
599
  };
601
600
  break;
602
601
  }
603
- const baseTotalDepth = 103; // Define the reference depth for scaling (103mm is a common default)
604
- const scaleFactor = totalDepth !== undefined && baseTotalDepth > 0 ? totalDepth / baseTotalDepth : 1;
605
-
606
- // Apply the scaling factor to all depth-related settings
607
- if (scaleFactor !== 1) {
608
- if (newSettings.frameDepth !== undefined) newSettings.frameDepth *= scaleFactor;
609
- if (newSettings.doorDepth !== undefined) newSettings.doorDepth *= scaleFactor;
610
- if (newSettings.doorStopDepth !== undefined) newSettings.doorStopDepth *= scaleFactor;
611
- if (newSettings.secondDoorStopDepth !== undefined) newSettings.secondDoorStopDepth *= scaleFactor;
612
- if (newSettings.gasketDepth !== undefined) newSettings.gasketDepth *= scaleFactor;
613
-
614
- // Handle string-based depths like "40mm" for notchDepth
615
- if (typeof newSettings.notchDepth === "string") {
616
- const num = parseInt(newSettings.notchDepth, 10);
617
- if (!isNaN(num)) {
618
- newSettings.notchDepth = "".concat(num * scaleFactor, "mm");
619
- }
620
- }
621
- }
622
602
  const isMxCaf = frameType.startsWith("MXCAF");
623
603
  setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
624
- visible: isMxCaf,
625
- depth: 12 * scaleFactor
604
+ visible: isMxCaf
626
605
  }));
627
606
  setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
628
- visible: isMxCaf,
629
- depth: 12 * scaleFactor
607
+ visible: isMxCaf
630
608
  }));
631
- setGlassDepth(8 * scaleFactor);
632
609
  const {
633
610
  doorDepth
634
611
  } = newSettings,
@@ -639,7 +616,7 @@ const ConfiguratorProvider = _ref => {
639
616
  theDoorDepth: doorDepth
640
617
  }));
641
618
  }
642
- }, [frameType, totalDepth]);
619
+ }, [frameType]);
643
620
 
644
621
  // --- Exterior Fanlight Logic ---
645
622
  React.useEffect(() => {
@@ -749,74 +726,61 @@ const useConfigurator = () => {
749
726
 
750
727
  const availableMaterials = {
751
728
  black: new THREE__namespace.MeshStandardMaterial({
752
- color: "#000000",
753
- side: THREE__namespace.DoubleSide
729
+ color: "#000000"
754
730
  }),
755
731
  metal: new THREE__namespace.MeshStandardMaterial({
756
732
  color: "#aaaaaa",
757
733
  metalness: 1.0,
758
- roughness: 0.4,
759
- side: THREE__namespace.DoubleSide
734
+ roughness: 0.4
760
735
  }),
761
736
  darkgrey: new THREE__namespace.MeshStandardMaterial({
762
- color: "#5e5e5e",
763
- side: THREE__namespace.DoubleSide
737
+ color: "#5e5e5e"
764
738
  }),
765
739
  grey: new THREE__namespace.MeshStandardMaterial({
766
- color: "#cccccc",
767
- side: THREE__namespace.DoubleSide
740
+ color: "#cccccc"
768
741
  }),
769
742
  yellow: new THREE__namespace.MeshStandardMaterial({
770
- color: "#ffff00",
771
- side: THREE__namespace.DoubleSide
743
+ color: "#ffff00"
772
744
  }),
773
745
  darkBrown: new THREE__namespace.MeshStandardMaterial({
774
- color: "#a0522d",
775
- side: THREE__namespace.DoubleSide
746
+ color: "#a0522d"
776
747
  }),
777
748
  brown: new THREE__namespace.MeshStandardMaterial({
778
- color: "#d2b48c",
779
- side: THREE__namespace.DoubleSide
749
+ color: "#d2b48c"
780
750
  }),
781
751
  glass: new THREE__namespace.MeshStandardMaterial({
782
752
  color: "#ffffff",
783
753
  roughness: 0.1,
784
754
  transparent: true,
785
- opacity: 0.7,
786
- side: THREE__namespace.DoubleSide
755
+ opacity: 0.7
787
756
  }),
788
757
  aluminum: new THREE__namespace.MeshStandardMaterial({
789
758
  color: "#abb0aa",
790
759
  metalness: 0.8,
791
760
  roughness: 0.5,
792
- envMapIntensity: 1.2,
793
- side: THREE__namespace.DoubleSide
761
+ envMapIntensity: 1.2
794
762
  }),
795
763
  aluminumBrighter: new THREE__namespace.MeshStandardMaterial({
796
764
  color: "#cdcdcd",
797
765
  metalness: 0.8,
798
766
  roughness: 0.5,
799
- envMapIntensity: 1.2,
800
- side: THREE__namespace.DoubleSide
767
+ envMapIntensity: 1.2
801
768
  }),
802
769
  aluminumExtraBrighter: new THREE__namespace.MeshStandardMaterial({
803
770
  color: "#ececec",
804
771
  metalness: 0.8,
805
772
  roughness: 0.5,
806
- envMapIntensity: 1.2,
807
- side: THREE__namespace.DoubleSide
773
+ envMapIntensity: 1.2
808
774
  }),
809
775
  silver: new THREE__namespace.MeshStandardMaterial({
810
776
  color: "#c0c0c0",
811
777
  metalness: 1.0,
812
- roughness: 0.2,
813
- side: THREE__namespace.DoubleSide
778
+ roughness: 0.2
814
779
  }),
815
780
  gold: new THREE__namespace.MeshStandardMaterial({
816
781
  color: "#ffd700",
817
782
  metalness: 1.0,
818
- roughness: 0.3,
819
- side: THREE__namespace.DoubleSide
783
+ roughness: 0.3
820
784
  }),
821
785
  diamond: new THREE__namespace.MeshStandardMaterial({
822
786
  color: "#e0f7fa",
@@ -824,24 +788,20 @@ const availableMaterials = {
824
788
  roughness: 0.05,
825
789
  transparent: true,
826
790
  opacity: 0.9,
827
- envMapIntensity: 1.5,
828
- side: THREE__namespace.DoubleSide
791
+ envMapIntensity: 1.5
829
792
  }),
830
793
  test_material: new THREE__namespace.MeshStandardMaterial({
831
794
  color: "red",
832
- roughness: 0.1,
833
- side: THREE__namespace.DoubleSide
795
+ roughness: 0.1
834
796
  })
835
797
  };
836
798
  new THREE__namespace.MeshStandardMaterial({
837
799
  color: "#cccccc",
838
- roughness: 0.8,
839
- side: THREE__namespace.DoubleSide
800
+ roughness: 0.8
840
801
  });
841
802
  new THREE__namespace.MeshStandardMaterial({
842
803
  color: "#000",
843
- roughness: 0.8,
844
- side: THREE__namespace.DoubleSide
804
+ roughness: 0.8
845
805
  });
846
806
 
847
807
  // Helper function to check for hex color codes
@@ -849,7 +809,7 @@ const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
849
809
 
850
810
  /**
851
811
  * A simple "builder" that creates a THREE.MeshStandardMaterial from a prop and an
852
- * optional map of pre-loaded textures. It does NOT load textures itself.
812
+ * optional map of pre-loaded textures. It now loads textures if they are not pre-loaded.
853
813
  * @param prop - The material definition (string or object).
854
814
  * @param textures - A map of URL -> THREE.Texture, provided by useTexture.
855
815
  * @returns A THREE.MeshStandardMaterial instance.
@@ -872,7 +832,8 @@ const buildMaterial = (prop, textures) => {
872
832
  } else if (textures && textures[sourceValue]) {
873
833
  params.map = textures[sourceValue];
874
834
  } else {
875
- params.color = "yellow";
835
+ const texture = new THREE__namespace.TextureLoader().load(sourceValue);
836
+ params.map = texture;
876
837
  }
877
838
  if (opacity !== undefined && opacity < 1) {
878
839
  params.transparent = true;
@@ -2311,24 +2272,20 @@ const DoorConfigurator = _ref => {
2311
2272
  is2D = false,
2312
2273
  totalWidth,
2313
2274
  totalHeight,
2314
- totalDepth // Destructure the new prop
2275
+ frameDepth
2315
2276
  } = _ref;
2316
- return (
2317
- /*#__PURE__*/
2318
- // Pass the totalDepth prop to the Provider
2319
- jsxRuntime.jsx(ConfiguratorProvider, {
2320
- initialIs2D: is2D,
2321
- totalDepth: totalDepth,
2322
- children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
2323
- doorName: doorName,
2324
- materials: materials,
2325
- doorPivot: doorPivot,
2326
- doorOpening: doorOpening,
2327
- totalWidth: totalWidth,
2328
- totalHeight: totalHeight
2329
- })
2277
+ return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
2278
+ initialIs2D: is2D,
2279
+ children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
2280
+ doorName: doorName,
2281
+ materials: materials,
2282
+ doorPivot: doorPivot,
2283
+ doorOpening: doorOpening,
2284
+ totalWidth: totalWidth,
2285
+ totalHeight: totalHeight,
2286
+ frameDepth: frameDepth
2330
2287
  })
2331
- );
2288
+ });
2332
2289
  };
2333
2290
 
2334
2291
  exports["default"] = DoorConfigurator;