door_models 5.4.0 → 5.4.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.
- package/dist/index.cjs.js +57 -66
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +58 -66
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8,6 +8,7 @@ var csg = require('@react-three/csg');
|
|
|
8
8
|
var three = require('@react-spring/three');
|
|
9
9
|
var THREE = require('three');
|
|
10
10
|
var drei = require('@react-three/drei');
|
|
11
|
+
var fiber = require('@react-three/fiber');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
@@ -102,8 +103,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
102
103
|
let {
|
|
103
104
|
children,
|
|
104
105
|
initialIs2D = false,
|
|
105
|
-
initialMaterials = {}
|
|
106
|
-
totalDepth
|
|
106
|
+
initialMaterials = {}
|
|
107
107
|
} = _ref;
|
|
108
108
|
const [materials, setMaterials] = React.useState(initialMaterials);
|
|
109
109
|
const [is2D, setIs2D] = React.useState(initialIs2D);
|
|
@@ -600,35 +600,13 @@ const ConfiguratorProvider = _ref => {
|
|
|
600
600
|
};
|
|
601
601
|
break;
|
|
602
602
|
}
|
|
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
603
|
const isMxCaf = frameType.startsWith("MXCAF");
|
|
623
604
|
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
624
|
-
visible: isMxCaf
|
|
625
|
-
depth: 12 * scaleFactor
|
|
605
|
+
visible: isMxCaf
|
|
626
606
|
}));
|
|
627
607
|
setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
628
|
-
visible: isMxCaf
|
|
629
|
-
depth: 12 * scaleFactor
|
|
608
|
+
visible: isMxCaf
|
|
630
609
|
}));
|
|
631
|
-
setGlassDepth(8 * scaleFactor);
|
|
632
610
|
const {
|
|
633
611
|
doorDepth
|
|
634
612
|
} = newSettings,
|
|
@@ -639,7 +617,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
639
617
|
theDoorDepth: doorDepth
|
|
640
618
|
}));
|
|
641
619
|
}
|
|
642
|
-
}, [frameType
|
|
620
|
+
}, [frameType]);
|
|
643
621
|
|
|
644
622
|
// --- Exterior Fanlight Logic ---
|
|
645
623
|
React.useEffect(() => {
|
|
@@ -749,61 +727,74 @@ const useConfigurator = () => {
|
|
|
749
727
|
|
|
750
728
|
const availableMaterials = {
|
|
751
729
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
752
|
-
color: "#000000"
|
|
730
|
+
color: "#000000",
|
|
731
|
+
side: THREE__namespace.DoubleSide
|
|
753
732
|
}),
|
|
754
733
|
metal: new THREE__namespace.MeshStandardMaterial({
|
|
755
734
|
color: "#aaaaaa",
|
|
756
735
|
metalness: 1.0,
|
|
757
|
-
roughness: 0.4
|
|
736
|
+
roughness: 0.4,
|
|
737
|
+
side: THREE__namespace.DoubleSide
|
|
758
738
|
}),
|
|
759
739
|
darkgrey: new THREE__namespace.MeshStandardMaterial({
|
|
760
|
-
color: "#5e5e5e"
|
|
740
|
+
color: "#5e5e5e",
|
|
741
|
+
side: THREE__namespace.DoubleSide
|
|
761
742
|
}),
|
|
762
743
|
grey: new THREE__namespace.MeshStandardMaterial({
|
|
763
|
-
color: "#cccccc"
|
|
744
|
+
color: "#cccccc",
|
|
745
|
+
side: THREE__namespace.DoubleSide
|
|
764
746
|
}),
|
|
765
747
|
yellow: new THREE__namespace.MeshStandardMaterial({
|
|
766
|
-
color: "#ffff00"
|
|
748
|
+
color: "#ffff00",
|
|
749
|
+
side: THREE__namespace.DoubleSide
|
|
767
750
|
}),
|
|
768
751
|
darkBrown: new THREE__namespace.MeshStandardMaterial({
|
|
769
|
-
color: "#a0522d"
|
|
752
|
+
color: "#a0522d",
|
|
753
|
+
side: THREE__namespace.DoubleSide
|
|
770
754
|
}),
|
|
771
755
|
brown: new THREE__namespace.MeshStandardMaterial({
|
|
772
|
-
color: "#d2b48c"
|
|
756
|
+
color: "#d2b48c",
|
|
757
|
+
side: THREE__namespace.DoubleSide
|
|
773
758
|
}),
|
|
774
759
|
glass: new THREE__namespace.MeshStandardMaterial({
|
|
775
760
|
color: "#ffffff",
|
|
776
761
|
roughness: 0.1,
|
|
777
762
|
transparent: true,
|
|
778
|
-
opacity: 0.7
|
|
763
|
+
opacity: 0.7,
|
|
764
|
+
side: THREE__namespace.DoubleSide
|
|
779
765
|
}),
|
|
780
766
|
aluminum: new THREE__namespace.MeshStandardMaterial({
|
|
781
767
|
color: "#abb0aa",
|
|
782
768
|
metalness: 0.8,
|
|
783
769
|
roughness: 0.5,
|
|
784
|
-
envMapIntensity: 1.2
|
|
770
|
+
envMapIntensity: 1.2,
|
|
771
|
+
side: THREE__namespace.DoubleSide
|
|
785
772
|
}),
|
|
786
773
|
aluminumBrighter: new THREE__namespace.MeshStandardMaterial({
|
|
787
774
|
color: "#cdcdcd",
|
|
788
775
|
metalness: 0.8,
|
|
789
776
|
roughness: 0.5,
|
|
790
|
-
envMapIntensity: 1.2
|
|
777
|
+
envMapIntensity: 1.2,
|
|
778
|
+
side: THREE__namespace.DoubleSide
|
|
791
779
|
}),
|
|
792
780
|
aluminumExtraBrighter: new THREE__namespace.MeshStandardMaterial({
|
|
793
781
|
color: "#ececec",
|
|
794
782
|
metalness: 0.8,
|
|
795
783
|
roughness: 0.5,
|
|
796
|
-
envMapIntensity: 1.2
|
|
784
|
+
envMapIntensity: 1.2,
|
|
785
|
+
side: THREE__namespace.DoubleSide
|
|
797
786
|
}),
|
|
798
787
|
silver: new THREE__namespace.MeshStandardMaterial({
|
|
799
788
|
color: "#c0c0c0",
|
|
800
789
|
metalness: 1.0,
|
|
801
|
-
roughness: 0.2
|
|
790
|
+
roughness: 0.2,
|
|
791
|
+
side: THREE__namespace.DoubleSide
|
|
802
792
|
}),
|
|
803
793
|
gold: new THREE__namespace.MeshStandardMaterial({
|
|
804
794
|
color: "#ffd700",
|
|
805
795
|
metalness: 1.0,
|
|
806
|
-
roughness: 0.3
|
|
796
|
+
roughness: 0.3,
|
|
797
|
+
side: THREE__namespace.DoubleSide
|
|
807
798
|
}),
|
|
808
799
|
diamond: new THREE__namespace.MeshStandardMaterial({
|
|
809
800
|
color: "#e0f7fa",
|
|
@@ -811,20 +802,24 @@ const availableMaterials = {
|
|
|
811
802
|
roughness: 0.05,
|
|
812
803
|
transparent: true,
|
|
813
804
|
opacity: 0.9,
|
|
814
|
-
envMapIntensity: 1.5
|
|
805
|
+
envMapIntensity: 1.5,
|
|
806
|
+
side: THREE__namespace.DoubleSide
|
|
815
807
|
}),
|
|
816
808
|
test_material: new THREE__namespace.MeshStandardMaterial({
|
|
817
809
|
color: "red",
|
|
818
|
-
roughness: 0.1
|
|
810
|
+
roughness: 0.1,
|
|
811
|
+
side: THREE__namespace.DoubleSide
|
|
819
812
|
})
|
|
820
813
|
};
|
|
821
814
|
new THREE__namespace.MeshStandardMaterial({
|
|
822
815
|
color: "#cccccc",
|
|
823
|
-
roughness: 0.8
|
|
816
|
+
roughness: 0.8,
|
|
817
|
+
side: THREE__namespace.DoubleSide
|
|
824
818
|
});
|
|
825
819
|
new THREE__namespace.MeshStandardMaterial({
|
|
826
820
|
color: "#000",
|
|
827
|
-
roughness: 0.8
|
|
821
|
+
roughness: 0.8,
|
|
822
|
+
side: THREE__namespace.DoubleSide
|
|
828
823
|
});
|
|
829
824
|
|
|
830
825
|
// Helper function to check for hex color codes
|
|
@@ -837,7 +832,8 @@ const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
|
|
|
837
832
|
* @param textures - A map of URL -> THREE.Texture, provided by useTexture.
|
|
838
833
|
* @returns A THREE.MeshStandardMaterial instance.
|
|
839
834
|
*/
|
|
840
|
-
const
|
|
835
|
+
const BuildMaterial = (prop, textures) => {
|
|
836
|
+
const texture = fiber.useLoader(THREE.TextureLoader, "https://threejs.org/examples/textures/hardwood2_diffuse.jpg");
|
|
841
837
|
if (!prop) {
|
|
842
838
|
return new THREE__namespace.MeshStandardMaterial({
|
|
843
839
|
color: "#cccccc",
|
|
@@ -847,15 +843,14 @@ const buildMaterial = (prop, textures) => {
|
|
|
847
843
|
const sourceValue = typeof prop === "string" ? prop : prop.value;
|
|
848
844
|
const opacity = typeof prop === "object" ? prop.opacity : 1;
|
|
849
845
|
const params = {
|
|
850
|
-
roughness: 0.8
|
|
851
|
-
side: THREE__namespace.DoubleSide
|
|
846
|
+
roughness: 0.8
|
|
852
847
|
};
|
|
853
848
|
if (isHexColor(sourceValue)) {
|
|
854
849
|
params.color = sourceValue;
|
|
855
850
|
} else if (textures && textures[sourceValue]) {
|
|
856
|
-
params.map =
|
|
851
|
+
params.map = texture;
|
|
857
852
|
} else {
|
|
858
|
-
params.color = "
|
|
853
|
+
params.color = "#cccccc";
|
|
859
854
|
}
|
|
860
855
|
if (opacity !== undefined && opacity < 1) {
|
|
861
856
|
params.transparent = true;
|
|
@@ -909,7 +904,7 @@ const useDoorMaterials = function () {
|
|
|
909
904
|
// 4. Now that textures are guaranteed to be loaded, build all materials.
|
|
910
905
|
// This memo ensures the materials are only created when props or textures change.
|
|
911
906
|
return React.useMemo(() => {
|
|
912
|
-
const build = prop =>
|
|
907
|
+
const build = prop => BuildMaterial(prop, textureMap);
|
|
913
908
|
return {
|
|
914
909
|
doorMaterial: build(materialsProp.Body),
|
|
915
910
|
frameMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),
|
|
@@ -2294,24 +2289,20 @@ const DoorConfigurator = _ref => {
|
|
|
2294
2289
|
is2D = false,
|
|
2295
2290
|
totalWidth,
|
|
2296
2291
|
totalHeight,
|
|
2297
|
-
|
|
2292
|
+
frameDepth
|
|
2298
2293
|
} = _ref;
|
|
2299
|
-
return (
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
doorOpening: doorOpening,
|
|
2310
|
-
totalWidth: totalWidth,
|
|
2311
|
-
totalHeight: totalHeight
|
|
2312
|
-
})
|
|
2294
|
+
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2295
|
+
initialIs2D: is2D,
|
|
2296
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
2297
|
+
doorName: doorName,
|
|
2298
|
+
materials: materials,
|
|
2299
|
+
doorPivot: doorPivot,
|
|
2300
|
+
doorOpening: doorOpening,
|
|
2301
|
+
totalWidth: totalWidth,
|
|
2302
|
+
totalHeight: totalHeight,
|
|
2303
|
+
frameDepth: frameDepth
|
|
2313
2304
|
})
|
|
2314
|
-
);
|
|
2305
|
+
});
|
|
2315
2306
|
};
|
|
2316
2307
|
|
|
2317
2308
|
exports["default"] = DoorConfigurator;
|