door_models 5.2.8 → 5.3.0
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 +371 -380
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +371 -380
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -179,11 +179,11 @@ const ConfiguratorProvider = _ref => {
|
|
|
179
179
|
});
|
|
180
180
|
const [frontDoorPlane, setFrontDoorPlane] = React.useState({
|
|
181
181
|
visible: true,
|
|
182
|
-
material: "
|
|
182
|
+
material: "frontDoor_material"
|
|
183
183
|
});
|
|
184
184
|
const [backDoorPlane, setBackDoorPlane] = React.useState({
|
|
185
185
|
visible: true,
|
|
186
|
-
material: "
|
|
186
|
+
material: "frontDoor_material"
|
|
187
187
|
});
|
|
188
188
|
const [glass, setGlass] = React.useState({
|
|
189
189
|
visible: false,
|
|
@@ -662,6 +662,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
662
662
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorContext.Provider, {
|
|
663
663
|
value: {
|
|
664
664
|
materials,
|
|
665
|
+
setMaterials,
|
|
665
666
|
is2D,
|
|
666
667
|
setIs2D,
|
|
667
668
|
isPlaneVisible,
|
|
@@ -722,41 +723,6 @@ const useConfigurator = () => {
|
|
|
722
723
|
return context;
|
|
723
724
|
};
|
|
724
725
|
|
|
725
|
-
// Re-use the same loader instance to leverage Three.js's caching
|
|
726
|
-
const textureLoader = new THREE__namespace.TextureLoader();
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Creates a THREE.MeshStandardMaterial from a string prop.
|
|
730
|
-
* - If the string starts with '#', it's treated as a hex color.
|
|
731
|
-
* - Otherwise, it's treated as a path to a texture image (URL or local path).
|
|
732
|
-
* @param value The color string or texture path.
|
|
733
|
-
* @returns A THREE.MeshStandardMaterial or null if no value is provided.
|
|
734
|
-
*/
|
|
735
|
-
const createMaterialFromProp = value => {
|
|
736
|
-
if (!value) {
|
|
737
|
-
return null; // Return null if the prop is empty
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
// Check if the value is a hexadecimal color code
|
|
741
|
-
if (value.startsWith("#")) {
|
|
742
|
-
return new THREE__namespace.MeshStandardMaterial({
|
|
743
|
-
color: value,
|
|
744
|
-
roughness: 0.8
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// Otherwise, assume it is a path to a texture
|
|
749
|
-
const texture = textureLoader.load(value);
|
|
750
|
-
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
751
|
-
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
752
|
-
|
|
753
|
-
// Improve texture sharpness at glancing angles
|
|
754
|
-
texture.anisotropy = 16;
|
|
755
|
-
return new THREE__namespace.MeshStandardMaterial({
|
|
756
|
-
map: texture,
|
|
757
|
-
roughness: 0.8
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
726
|
const availableMaterials = {
|
|
761
727
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
762
728
|
color: "#000000"
|
|
@@ -766,6 +732,21 @@ const availableMaterials = {
|
|
|
766
732
|
metalness: 1.0,
|
|
767
733
|
roughness: 0.4
|
|
768
734
|
}),
|
|
735
|
+
darkgrey: new THREE__namespace.MeshStandardMaterial({
|
|
736
|
+
color: "#5e5e5e"
|
|
737
|
+
}),
|
|
738
|
+
grey: new THREE__namespace.MeshStandardMaterial({
|
|
739
|
+
color: "#cccccc"
|
|
740
|
+
}),
|
|
741
|
+
yellow: new THREE__namespace.MeshStandardMaterial({
|
|
742
|
+
color: "#ffff00"
|
|
743
|
+
}),
|
|
744
|
+
darkBrown: new THREE__namespace.MeshStandardMaterial({
|
|
745
|
+
color: "#a0522d"
|
|
746
|
+
}),
|
|
747
|
+
brown: new THREE__namespace.MeshStandardMaterial({
|
|
748
|
+
color: "#d2b48c"
|
|
749
|
+
}),
|
|
769
750
|
glass: new THREE__namespace.MeshStandardMaterial({
|
|
770
751
|
color: "#ffffff",
|
|
771
752
|
roughness: 0.1,
|
|
@@ -789,32 +770,134 @@ const availableMaterials = {
|
|
|
789
770
|
metalness: 0.8,
|
|
790
771
|
roughness: 0.5,
|
|
791
772
|
envMapIntensity: 1.2
|
|
773
|
+
}),
|
|
774
|
+
silver: new THREE__namespace.MeshStandardMaterial({
|
|
775
|
+
color: "#c0c0c0",
|
|
776
|
+
metalness: 1.0,
|
|
777
|
+
roughness: 0.2
|
|
778
|
+
}),
|
|
779
|
+
gold: new THREE__namespace.MeshStandardMaterial({
|
|
780
|
+
color: "#ffd700",
|
|
781
|
+
metalness: 1.0,
|
|
782
|
+
roughness: 0.3
|
|
783
|
+
}),
|
|
784
|
+
diamond: new THREE__namespace.MeshStandardMaterial({
|
|
785
|
+
color: "#e0f7fa",
|
|
786
|
+
metalness: 0.9,
|
|
787
|
+
roughness: 0.05,
|
|
788
|
+
transparent: true,
|
|
789
|
+
opacity: 0.9,
|
|
790
|
+
envMapIntensity: 1.5
|
|
791
|
+
}),
|
|
792
|
+
test_material: new THREE__namespace.MeshStandardMaterial({
|
|
793
|
+
color: "red",
|
|
794
|
+
roughness: 0.1
|
|
792
795
|
})
|
|
793
796
|
};
|
|
794
|
-
|
|
797
|
+
new THREE__namespace.MeshStandardMaterial({
|
|
795
798
|
color: "#cccccc",
|
|
796
799
|
roughness: 0.8
|
|
797
800
|
});
|
|
798
|
-
|
|
801
|
+
new THREE__namespace.MeshStandardMaterial({
|
|
799
802
|
color: "#000",
|
|
800
803
|
roughness: 0.8
|
|
801
804
|
});
|
|
802
805
|
|
|
806
|
+
const textureLoader = new THREE__namespace.TextureLoader();
|
|
807
|
+
const textureCache = {};
|
|
808
|
+
const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
|
|
809
|
+
const isUrl = str => str.startsWith("http") || str.startsWith("/");
|
|
810
|
+
const getFirstValidValue = values => {
|
|
811
|
+
for (const val of values) {
|
|
812
|
+
if (val) {
|
|
813
|
+
return val;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return undefined;
|
|
817
|
+
};
|
|
818
|
+
const createDynamicMaterial = prop => {
|
|
819
|
+
if (!prop) {
|
|
820
|
+
return new THREE__namespace.MeshStandardMaterial({
|
|
821
|
+
color: "#cccccc",
|
|
822
|
+
roughness: 0.8
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
const sourceValue = typeof prop === "string" ? prop : prop.value;
|
|
826
|
+
const opacity = typeof prop === "object" ? prop.opacity : 1;
|
|
827
|
+
const params = {
|
|
828
|
+
roughness: 0.8
|
|
829
|
+
};
|
|
830
|
+
if (isHexColor(sourceValue)) {
|
|
831
|
+
params.color = sourceValue;
|
|
832
|
+
} else if (isUrl(sourceValue)) {
|
|
833
|
+
if (!textureCache[sourceValue]) {
|
|
834
|
+
textureCache[sourceValue] = textureLoader.load(sourceValue);
|
|
835
|
+
}
|
|
836
|
+
params.map = textureCache[sourceValue];
|
|
837
|
+
} else {
|
|
838
|
+
params.color = "#cccccc";
|
|
839
|
+
}
|
|
840
|
+
if (opacity !== undefined && opacity < 1) {
|
|
841
|
+
params.transparent = true;
|
|
842
|
+
params.opacity = opacity;
|
|
843
|
+
}
|
|
844
|
+
return new THREE__namespace.MeshStandardMaterial(params);
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* A custom hook to generate memoized materials for the door model.
|
|
849
|
+
* @param materialsProp - The materials object passed as props.
|
|
850
|
+
* @returns An object containing all the necessary THREE.Material instances.
|
|
851
|
+
*/
|
|
852
|
+
const useDoorMaterials = function () {
|
|
853
|
+
let materialsProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
854
|
+
// --- Material Logic ---
|
|
855
|
+
|
|
856
|
+
const doorMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.Body), [materialsProp.Body]);
|
|
857
|
+
const frameMaterial = React.useMemo(() => createDynamicMaterial(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])), [materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2]);
|
|
858
|
+
const gasketMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_GASKET), [materialsProp.D_GASKET]);
|
|
859
|
+
const doorStopMaterial = React.useMemo(() => createDynamicMaterial(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])), [materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2]);
|
|
860
|
+
const interiorFanlightMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_SRF_DECOR), [materialsProp.D_SRF_DECOR]);
|
|
861
|
+
const exteriorFanlightMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_SRF_DECOR), [materialsProp.D_SRF_DECOR]);
|
|
862
|
+
const occulusInfillMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_FR_COLOR), [materialsProp.D_FR_COLOR]);
|
|
863
|
+
const glassInfillMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_FR_COLOR), [materialsProp.D_FR_COLOR]);
|
|
864
|
+
const frontCoverPanelMaterial = React.useMemo(() => createDynamicMaterial(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])), [materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2]);
|
|
865
|
+
const backCoverPanelMaterial = React.useMemo(() => createDynamicMaterial(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])), [materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2]);
|
|
866
|
+
const frontDoorPlaneMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_SRF_DECOR_2), [materialsProp.D_SRF_DECOR_2]);
|
|
867
|
+
const backDoorPlaneMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.D_SRF_DECOR), [materialsProp.D_SRF_DECOR]);
|
|
868
|
+
const hingeBodyMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.Hinge), [materialsProp.Hinge]);
|
|
869
|
+
const hingeAccentMaterial = React.useMemo(() => createDynamicMaterial(materialsProp.HingeCuts), [materialsProp.HingeCuts]);
|
|
870
|
+
return React.useMemo(() => ({
|
|
871
|
+
doorMaterial,
|
|
872
|
+
frameMaterial,
|
|
873
|
+
gasketMaterial,
|
|
874
|
+
doorStopMaterial,
|
|
875
|
+
interiorFanlightMaterial,
|
|
876
|
+
exteriorFanlightMaterial,
|
|
877
|
+
occulusInfillMaterial,
|
|
878
|
+
glassInfillMaterial,
|
|
879
|
+
hingeBodyMaterial,
|
|
880
|
+
frontCoverPanelMaterial,
|
|
881
|
+
backCoverPanelMaterial,
|
|
882
|
+
frontDoorPlaneMaterial,
|
|
883
|
+
backDoorPlaneMaterial,
|
|
884
|
+
hingeAccentMaterial
|
|
885
|
+
}), [doorMaterial, frameMaterial, gasketMaterial, doorStopMaterial, interiorFanlightMaterial, exteriorFanlightMaterial, occulusInfillMaterial, glassInfillMaterial, hingeBodyMaterial, frontCoverPanelMaterial, backCoverPanelMaterial, frontDoorPlaneMaterial, backDoorPlaneMaterial, hingeAccentMaterial]);
|
|
886
|
+
};
|
|
887
|
+
|
|
803
888
|
function StandardHandle(_ref) {
|
|
804
889
|
let {
|
|
805
890
|
position,
|
|
806
891
|
doorDepthM,
|
|
807
892
|
doorPivot,
|
|
808
|
-
frameType
|
|
893
|
+
frameType
|
|
809
894
|
} = _ref;
|
|
810
895
|
// --- Base Dimensions ---
|
|
811
896
|
const roseRadius = 0.035;
|
|
812
897
|
|
|
813
898
|
// --- Thickness ---
|
|
814
899
|
// default 5mm, but 8mm + 1–2mm if WDG frame
|
|
815
|
-
const roseThickness = frameType === "WDGF_WDG100" ? 0.008 + 0.0015
|
|
816
|
-
: 0.005; // 5mm default
|
|
817
|
-
|
|
900
|
+
const roseThickness = frameType === "WDGF_WDG100" ? 0.008 + 0.0015 : 0.005;
|
|
818
901
|
const handleRadius = 0.015;
|
|
819
902
|
const handleLength = 0.2;
|
|
820
903
|
|
|
@@ -902,10 +985,8 @@ function StandardHandle(_ref) {
|
|
|
902
985
|
args: [roseRadius, roseRadius, roseThickness, 48]
|
|
903
986
|
})
|
|
904
987
|
}), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
905
|
-
position: [0, -(0.08 + roseGapY),
|
|
906
|
-
|
|
907
|
-
z + (z > 0 ? roseThickness : -roseThickness) // 👈 accounts for thickness
|
|
908
|
-
],
|
|
988
|
+
position: [0, -(0.08 + roseGapY), z + (z > 0 ? roseThickness : -roseThickness)],
|
|
989
|
+
castShadow: true,
|
|
909
990
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
910
991
|
rotation: [Math.PI / 2, 0, 0],
|
|
911
992
|
position: [0, 0.0075, 0],
|
|
@@ -979,6 +1060,11 @@ function StandardHandle(_ref) {
|
|
|
979
1060
|
})]
|
|
980
1061
|
});
|
|
981
1062
|
}
|
|
1063
|
+
|
|
1064
|
+
// {
|
|
1065
|
+
// /* MergedPlate */
|
|
1066
|
+
// }
|
|
1067
|
+
|
|
982
1068
|
const MergedPlate = _ref2 => {
|
|
983
1069
|
let {
|
|
984
1070
|
plateMaterial,
|
|
@@ -986,10 +1072,6 @@ const MergedPlate = _ref2 => {
|
|
|
986
1072
|
faceZ
|
|
987
1073
|
} = _ref2;
|
|
988
1074
|
const geometry = React.useMemo(() => {
|
|
989
|
-
// Left half - sharp edges
|
|
990
|
-
const leftHalf = new THREE__namespace.BoxGeometry(0.05, 0.24, roseThickness);
|
|
991
|
-
leftHalf.translate(-0.025, 0, 0); // Center the left half
|
|
992
|
-
|
|
993
1075
|
const shape = new THREE__namespace.Shape();
|
|
994
1076
|
const width = 0.1;
|
|
995
1077
|
const height = 0.24;
|
|
@@ -1017,13 +1099,17 @@ const MergedPlate = _ref2 => {
|
|
|
1017
1099
|
})
|
|
1018
1100
|
});
|
|
1019
1101
|
};
|
|
1102
|
+
|
|
1103
|
+
// {
|
|
1104
|
+
// /* GlassHandle */
|
|
1105
|
+
// }
|
|
1106
|
+
|
|
1020
1107
|
function GlassHandle(_ref3) {
|
|
1021
1108
|
let {
|
|
1022
1109
|
position,
|
|
1023
1110
|
doorDepthM,
|
|
1024
1111
|
doorPivot
|
|
1025
1112
|
} = _ref3;
|
|
1026
|
-
// --- Dimensions ---
|
|
1027
1113
|
const roseRadius = 0.035;
|
|
1028
1114
|
const roseThickness = 0.005;
|
|
1029
1115
|
const handleRadius = 0.015;
|
|
@@ -1119,6 +1205,10 @@ function GlassHandle(_ref3) {
|
|
|
1119
1205
|
})]
|
|
1120
1206
|
});
|
|
1121
1207
|
}
|
|
1208
|
+
|
|
1209
|
+
// {
|
|
1210
|
+
// /* DoorHandle */
|
|
1211
|
+
// }
|
|
1122
1212
|
function DoorHandle(_ref4) {
|
|
1123
1213
|
let {
|
|
1124
1214
|
bodyType,
|
|
@@ -1129,7 +1219,9 @@ function DoorHandle(_ref4) {
|
|
|
1129
1219
|
} = _ref4;
|
|
1130
1220
|
const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
|
|
1131
1221
|
const handlePos = [handleX, handleHeightM, 0];
|
|
1132
|
-
const
|
|
1222
|
+
const {
|
|
1223
|
+
frameType
|
|
1224
|
+
} = useConfigurator();
|
|
1133
1225
|
return isSingleGlass ? /*#__PURE__*/jsxRuntime.jsx(GlassHandle, {
|
|
1134
1226
|
position: [handleX, handleHeightM, -0.0024],
|
|
1135
1227
|
doorDepthM: doorDepthM,
|
|
@@ -1141,6 +1233,11 @@ function DoorHandle(_ref4) {
|
|
|
1141
1233
|
frameType: frameType
|
|
1142
1234
|
});
|
|
1143
1235
|
}
|
|
1236
|
+
|
|
1237
|
+
// {
|
|
1238
|
+
// /* GlassHinge */
|
|
1239
|
+
// }
|
|
1240
|
+
|
|
1144
1241
|
function GlassHinge(_ref5) {
|
|
1145
1242
|
let {
|
|
1146
1243
|
position,
|
|
@@ -1221,6 +1318,13 @@ function GlassHinge(_ref5) {
|
|
|
1221
1318
|
})]
|
|
1222
1319
|
});
|
|
1223
1320
|
}
|
|
1321
|
+
// {
|
|
1322
|
+
// /* DoorStopCutsProps */
|
|
1323
|
+
// }
|
|
1324
|
+
|
|
1325
|
+
// {
|
|
1326
|
+
// /* DoorStopCuts */
|
|
1327
|
+
// }
|
|
1224
1328
|
function DoorStopCuts(_ref6) {
|
|
1225
1329
|
let {
|
|
1226
1330
|
visible,
|
|
@@ -1259,84 +1363,85 @@ function DoorStopCuts(_ref6) {
|
|
|
1259
1363
|
})]
|
|
1260
1364
|
});
|
|
1261
1365
|
}
|
|
1366
|
+
|
|
1367
|
+
// {
|
|
1368
|
+
// /* DoorModelsProps */
|
|
1369
|
+
// }
|
|
1370
|
+
|
|
1371
|
+
// {
|
|
1372
|
+
// /* AllMaterialsType */
|
|
1373
|
+
// }
|
|
1374
|
+
|
|
1375
|
+
// {
|
|
1376
|
+
// /* DoorLeafProps */
|
|
1377
|
+
// }
|
|
1378
|
+
|
|
1379
|
+
// {
|
|
1380
|
+
// /* DoorModels */
|
|
1381
|
+
// }
|
|
1382
|
+
|
|
1262
1383
|
function DoorModels(_ref7) {
|
|
1263
1384
|
let {
|
|
1264
|
-
doorName
|
|
1385
|
+
doorName,
|
|
1386
|
+
materials: materialsProp,
|
|
1387
|
+
doorPivot: doorPivotProp,
|
|
1388
|
+
doorOpening: doorOpeningProp
|
|
1265
1389
|
} = _ref7;
|
|
1266
1390
|
const {
|
|
1267
1391
|
is2D,
|
|
1268
1392
|
totalWidth,
|
|
1269
|
-
totalHeight,
|
|
1270
1393
|
isFrameVisible,
|
|
1271
1394
|
door,
|
|
1395
|
+
setDoor,
|
|
1272
1396
|
doorFrame,
|
|
1273
1397
|
interiorFanlight,
|
|
1274
1398
|
exteriorFanlight,
|
|
1275
|
-
occulus,
|
|
1276
1399
|
frontCoverPanel,
|
|
1277
1400
|
backCoverPanel,
|
|
1278
|
-
frontDoorPlane,
|
|
1279
|
-
backDoorPlane,
|
|
1280
1401
|
frameType,
|
|
1281
|
-
bodyType,
|
|
1282
|
-
exteriorFanlightType,
|
|
1283
1402
|
glassVisible,
|
|
1284
1403
|
glassDepth,
|
|
1285
1404
|
handleParseCpid,
|
|
1286
1405
|
isDoubleDoor,
|
|
1287
|
-
|
|
1406
|
+
setMaterials
|
|
1288
1407
|
} = useConfigurator();
|
|
1289
1408
|
React.useEffect(() => {
|
|
1290
1409
|
if (doorName) {
|
|
1291
1410
|
handleParseCpid(doorName);
|
|
1292
1411
|
}
|
|
1293
1412
|
}, [doorName, handleParseCpid]);
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (Object.prototype.hasOwnProperty.call(materials, key)) {
|
|
1298
|
-
const value = materials[key];
|
|
1299
|
-
dynamicMaterials[key] = createMaterialFromProp(value);
|
|
1300
|
-
}
|
|
1413
|
+
React.useEffect(() => {
|
|
1414
|
+
if (materialsProp) {
|
|
1415
|
+
setMaterials(materialsProp);
|
|
1301
1416
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
React.
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
default:
|
|
1317
|
-
return availableMaterials.metal;
|
|
1417
|
+
}, [materialsProp, setMaterials]);
|
|
1418
|
+
React.useEffect(() => {
|
|
1419
|
+
if (doorName) handleParseCpid(doorName);
|
|
1420
|
+
}, [doorName, handleParseCpid]);
|
|
1421
|
+
React.useEffect(() => {
|
|
1422
|
+
if (materialsProp) setMaterials(materialsProp);
|
|
1423
|
+
}, [materialsProp, setMaterials]);
|
|
1424
|
+
React.useEffect(() => {
|
|
1425
|
+
if (doorPivotProp || doorOpeningProp) {
|
|
1426
|
+
setDoor(prevDoor => _objectSpread2(_objectSpread2(_objectSpread2({}, prevDoor), doorPivotProp && {
|
|
1427
|
+
doorPivot: doorPivotProp
|
|
1428
|
+
}), doorOpeningProp && {
|
|
1429
|
+
doorOpening: doorOpeningProp
|
|
1430
|
+
}));
|
|
1318
1431
|
}
|
|
1319
|
-
}, [
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
const frontCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterial, [pers]);
|
|
1324
|
-
const backCoverPanelMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterial, [pers]);
|
|
1325
|
-
React.useMemo(() => pers.D_SRF_DECOR_2 || placeholderMaterial, [pers]);
|
|
1326
|
-
React.useMemo(() => pers.D_SRF_DECOR || placeholderMaterial, [pers]);
|
|
1327
|
-
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1328
|
-
color: "#1a1a1a",
|
|
1329
|
-
roughness: 0.1
|
|
1330
|
-
}), []);
|
|
1432
|
+
}, [doorPivotProp, doorOpeningProp, setDoor]);
|
|
1433
|
+
|
|
1434
|
+
// --- Material Logic (Centralized in parent component) ---
|
|
1435
|
+
const allMaterials = useDoorMaterials(materialsProp);
|
|
1331
1436
|
|
|
1332
1437
|
// --- Dimension calculations ---
|
|
1333
1438
|
const {
|
|
1334
1439
|
doorWidth,
|
|
1335
1440
|
doorHeight,
|
|
1336
|
-
theDoorDepth
|
|
1337
|
-
doorPivot,
|
|
1338
|
-
doorOpening
|
|
1441
|
+
theDoorDepth
|
|
1339
1442
|
} = door;
|
|
1443
|
+
const doorPivot = doorPivotProp || door.doorPivot;
|
|
1444
|
+
const doorOpening = doorOpeningProp || door.doorOpening;
|
|
1340
1445
|
const {
|
|
1341
1446
|
frameDepth,
|
|
1342
1447
|
topThk,
|
|
@@ -1369,8 +1474,8 @@ function DoorModels(_ref7) {
|
|
|
1369
1474
|
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
1370
1475
|
|
|
1371
1476
|
// Convert dimensions from mm to meters
|
|
1372
|
-
const doorWidthM = doorWidth / 1000;
|
|
1373
1477
|
const interiorFanlightHeightM = interiorFanlightHeight / 1000;
|
|
1478
|
+
const doorWidthM = doorWidth / 1000;
|
|
1374
1479
|
const totalOpeningHeightM = doorHeight / 1000;
|
|
1375
1480
|
const doorDepthM = theDoorDepth / 1000;
|
|
1376
1481
|
const frameDepthM = frameDepth / 1000;
|
|
@@ -1381,106 +1486,31 @@ function DoorModels(_ref7) {
|
|
|
1381
1486
|
const exteriorFanlightDepthM = exteriorFanlightDepthValue / 1000;
|
|
1382
1487
|
const doorStopWidthM = doorStopWidth / 1000;
|
|
1383
1488
|
const doorStopDepthM = doorStopDepth / 1000;
|
|
1384
|
-
|
|
1385
|
-
// Architrave Dimensions
|
|
1386
1489
|
const architraveProfileM = architraveWidth / 1000;
|
|
1387
1490
|
const architraveDepthM = architraveDepth / 1000;
|
|
1388
|
-
|
|
1389
|
-
// Gasket Dimensions
|
|
1390
1491
|
const gasketWidthM = gasketWidth / 1000;
|
|
1391
1492
|
const gasketDepthM = gasketDepth / 1000;
|
|
1392
|
-
const
|
|
1393
|
-
const
|
|
1394
|
-
const
|
|
1395
|
-
const notchWidthValue = parseInt(notchWidth) || 20;
|
|
1396
|
-
const notchWidthM = notchWidthValue / 1000;
|
|
1397
|
-
const notchDepthM = notchDepthValue / 1000;
|
|
1493
|
+
const doorStopOffsetFromEdgeM = parseInt(doorStopOffset) / 1000;
|
|
1494
|
+
const notchWidthM = (parseInt(notchWidth) || 20) / 1000;
|
|
1495
|
+
const notchDepthM = (parseInt(notchDepth) || 40) / 1000;
|
|
1398
1496
|
const isOpeningIn = doorOpening === "in";
|
|
1399
1497
|
const doorStopPositionZ = React.useMemo(() => isOpeningIn ? frameDepthM / 2 - doorStopOffsetFromEdgeM - doorStopDepthM / 2 : -frameDepthM / 2 + doorStopOffsetFromEdgeM + doorStopDepthM / 2, [isOpeningIn, frameDepthM, doorStopOffsetFromEdgeM, doorStopDepthM]);
|
|
1400
1498
|
const gasketZPosition = React.useMemo(() => isOpeningIn ? doorStopPositionZ - doorStopDepthM / 2 - gasketDepthM / 2 : doorStopPositionZ + doorStopDepthM / 2 + gasketDepthM / 2, [isOpeningIn, doorStopPositionZ, doorStopDepthM, gasketDepthM]);
|
|
1401
1499
|
const secondDoorStopWidthM = secondDoorStopWidth / 1000;
|
|
1402
1500
|
const secondDoorStopDepthM = secondDoorStopDepth / 1000;
|
|
1403
1501
|
const secondDoorStopPositionZ = isOpeningIn ? frameDepthM / 2 - secondDoorStopDepthM / 2 : -frameDepthM / 2 + secondDoorStopDepthM / 2;
|
|
1404
|
-
|
|
1405
|
-
// Position the first glass panel against the primary doorstop
|
|
1406
|
-
|
|
1407
1502
|
const secondGasketZPosition = isOpeningIn ? secondDoorStopPositionZ - secondDoorStopDepthM / 2 - gasketDepthM / 2 : secondDoorStopPositionZ + secondDoorStopDepthM / 2 + gasketDepthM / 2;
|
|
1408
1503
|
const doorCenterZ = React.useMemo(() => {
|
|
1409
1504
|
if (frameType === "WF_FLI") {
|
|
1410
|
-
|
|
1411
|
-
return frameDepthM / 2 - doorDepthM / 2;
|
|
1412
|
-
} else {
|
|
1413
|
-
return -frameDepthM / 2 + doorDepthM / 2;
|
|
1414
|
-
}
|
|
1505
|
+
return isOpeningIn ? frameDepthM / 2 - doorDepthM / 2 : -frameDepthM / 2 + doorDepthM / 2;
|
|
1415
1506
|
}
|
|
1416
|
-
if (
|
|
1507
|
+
if (["WDGF_WDG100", "WF_100"].includes(frameType)) {
|
|
1417
1508
|
return 0;
|
|
1418
|
-
} else {
|
|
1419
|
-
if (isOpeningIn) {
|
|
1420
|
-
const gasketBackFaceZ = gasketZPosition - gasketDepthM / 2;
|
|
1421
|
-
return gasketBackFaceZ - doorDepthM / 2;
|
|
1422
|
-
} else {
|
|
1423
|
-
const gasketFrontFaceZ = gasketZPosition + gasketDepthM / 2;
|
|
1424
|
-
return gasketFrontFaceZ + doorDepthM / 2;
|
|
1425
|
-
}
|
|
1426
1509
|
}
|
|
1510
|
+
const gasketFaceZ = isOpeningIn ? gasketZPosition - gasketDepthM / 2 : gasketZPosition + gasketDepthM / 2;
|
|
1511
|
+
return isOpeningIn ? gasketFaceZ - doorDepthM / 2 : gasketFaceZ + doorDepthM / 2;
|
|
1427
1512
|
}, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
|
|
1428
1513
|
const GlassPanelDepthM = glassDepth / 1000;
|
|
1429
|
-
const exteriorFanlightZPosition = exteriorFanlightType === "ALSGFL" ? 0 // Center it
|
|
1430
|
-
: isOpeningIn ? -frameDepthM / 2 + exteriorFanlightDepthM / 2 : frameDepthM / 2 - exteriorFanlightDepthM / 2;
|
|
1431
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
1432
|
-
const leftGlass_Z = -frameDepthM / 2 + GlassPanelDepthM / 2 - GlassPanelDepthM;
|
|
1433
|
-
const rightGlass_Z = frameDepthM / 2 - GlassPanelDepthM / 2 + GlassPanelDepthM;
|
|
1434
|
-
const directionMultiplier = doorOpening === "in" ? 1 : -1;
|
|
1435
|
-
three.useSpring({
|
|
1436
|
-
rotation: isOpen ? [0, (doorPivot === "left" ? Math.PI / 2 : -Math.PI / 2) * directionMultiplier, 0] : [0, 0, 0],
|
|
1437
|
-
config: {
|
|
1438
|
-
mass: 1,
|
|
1439
|
-
tension: 100,
|
|
1440
|
-
friction: 20
|
|
1441
|
-
}
|
|
1442
|
-
});
|
|
1443
|
-
const totalFrameWidth = totalOpeningWidthM + sidesFrameWidthM * 2;
|
|
1444
|
-
const totalFrameHeightM = totalOpeningHeightM + topFrameWidthM;
|
|
1445
|
-
const yCenteringOffset = -topFrameWidthM / 2;
|
|
1446
|
-
const sideFrameCenterY = topFrameWidthM / 2;
|
|
1447
|
-
const interiorFanlightYPosition = totalOpeningHeightM / 2 - interiorFanlightHeightM / 2;
|
|
1448
|
-
const topFrameCenterY = totalOpeningHeightM / 2 + topFrameWidthM / 2;
|
|
1449
|
-
const topOfFrameY = topFrameCenterY + topFrameWidthM / 2;
|
|
1450
|
-
const exteriorFanlightYPosition = topOfFrameY + exteriorFanlightHeightM / 2;
|
|
1451
|
-
const frontArchitraveZ = frameDepthM / 2 + architraveDepthM / 2;
|
|
1452
|
-
const backArchitraveZ = -frameDepthM / 2 - architraveDepthM / 2;
|
|
1453
|
-
const sideArchitraveHeight = totalOpeningHeightM;
|
|
1454
|
-
const sideArchitraveCenterY = 0;
|
|
1455
|
-
const leftArchitraveX = -totalOpeningWidthM / 2 - architraveProfileM / 2;
|
|
1456
|
-
const rightArchitraveX = totalOpeningWidthM / 2 + architraveProfileM / 2;
|
|
1457
|
-
const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
|
|
1458
|
-
const topArchitraveWidth = totalOpeningWidthM + 2 * architraveProfileM;
|
|
1459
|
-
const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1460
|
-
const leftGasketXPosition = -totalOpeningWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
|
|
1461
|
-
const rightGasketXPosition = totalOpeningWidthM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1462
|
-
|
|
1463
|
-
// --- Second Gasket ---
|
|
1464
|
-
|
|
1465
|
-
const secondTopGasketYPosition = totalOpeningHeightM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1466
|
-
const secondLeftGasketXPosition = -totalOpeningWidthM / 2 + secondDoorStopWidthM - gasketWidthM / 2;
|
|
1467
|
-
const secondRightGasketXPosition = totalOpeningWidthM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1468
|
-
const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
|
|
1469
|
-
const pivotNewPosition = React.useMemo(() => {
|
|
1470
|
-
if (initialDoorHeight.current === null || initialDoorHeight.current === 0) {
|
|
1471
|
-
return 0;
|
|
1472
|
-
}
|
|
1473
|
-
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1474
|
-
}, [doorHeight]);
|
|
1475
|
-
React.useMemo(() => {
|
|
1476
|
-
if (isGlassDoor) return false;
|
|
1477
|
-
if (!isFrameVisible) return false;
|
|
1478
|
-
const invisibleFrameTypes = ["WDGF_WDG100", "WF_100", "WF_FLI"];
|
|
1479
|
-
if (invisibleFrameTypes.includes(frameType)) {
|
|
1480
|
-
return false;
|
|
1481
|
-
}
|
|
1482
|
-
return true;
|
|
1483
|
-
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
1484
1514
|
const doorInstances = React.useMemo(() => {
|
|
1485
1515
|
if (isDoubleDoor) {
|
|
1486
1516
|
return [{
|
|
@@ -1499,6 +1529,31 @@ function DoorModels(_ref7) {
|
|
|
1499
1529
|
x: 0
|
|
1500
1530
|
}];
|
|
1501
1531
|
}, [isDoubleDoor, doorWidthM, doorPivot]);
|
|
1532
|
+
const pivotNewPosition = React.useMemo(() => {
|
|
1533
|
+
if (!initialDoorHeight.current || initialDoorHeight.current === 0) return 0;
|
|
1534
|
+
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1535
|
+
}, [doorHeight]);
|
|
1536
|
+
|
|
1537
|
+
// --- Centering & Positioning ---
|
|
1538
|
+
const yCenteringOffset = -topFrameWidthM / 2;
|
|
1539
|
+
const sideFrameCenterY = topFrameWidthM / 2;
|
|
1540
|
+
const interiorFanlightYPosition = totalOpeningHeightM / 2 - interiorFanlightHeightM / 2;
|
|
1541
|
+
const topFrameCenterY = totalOpeningHeightM / 2 + topFrameWidthM / 2;
|
|
1542
|
+
const exteriorFanlightYPosition = topFrameCenterY + topFrameWidthM / 2 + exteriorFanlightHeightM / 2;
|
|
1543
|
+
const frontArchitraveZ = frameDepthM / 2 + architraveDepthM / 2;
|
|
1544
|
+
const backArchitraveZ = -frameDepthM / 2 - architraveDepthM / 2;
|
|
1545
|
+
const leftArchitraveX = -totalOpeningWidthM / 2 - architraveProfileM / 2;
|
|
1546
|
+
const rightArchitraveX = totalOpeningWidthM / 2 + architraveProfileM / 2;
|
|
1547
|
+
const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
|
|
1548
|
+
const topArchitraveWidth = totalOpeningWidthM + 2 * architraveProfileM;
|
|
1549
|
+
const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1550
|
+
const leftGasketXPosition = -totalOpeningWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
|
|
1551
|
+
const rightGasketXPosition = totalOpeningWidthM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1552
|
+
const secondTopGasketYPosition = totalOpeningHeightM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1553
|
+
const secondLeftGasketXPosition = -totalOpeningWidthM / 2 + secondDoorStopWidthM - gasketWidthM / 2;
|
|
1554
|
+
const secondRightGasketXPosition = totalOpeningWidthM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1555
|
+
const leftGlass_Z = -frameDepthM / 2 + GlassPanelDepthM / 2 - GlassPanelDepthM;
|
|
1556
|
+
const rightGlass_Z = frameDepthM / 2 - GlassPanelDepthM / 2 + GlassPanelDepthM;
|
|
1502
1557
|
if (is2D) {
|
|
1503
1558
|
return /*#__PURE__*/jsxRuntime.jsx("group", {
|
|
1504
1559
|
"position-y": yCenteringOffset + 0.1,
|
|
@@ -1520,23 +1575,23 @@ function DoorModels(_ref7) {
|
|
|
1520
1575
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1521
1576
|
position: [0, topArchitraveY, 0],
|
|
1522
1577
|
castShadow: true,
|
|
1523
|
-
material: frontCoverPanelMaterial,
|
|
1578
|
+
material: allMaterials.frontCoverPanelMaterial,
|
|
1524
1579
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1525
1580
|
args: [topArchitraveWidth, architraveProfileM, architraveDepthM]
|
|
1526
1581
|
})
|
|
1527
1582
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1528
|
-
position: [leftArchitraveX,
|
|
1583
|
+
position: [leftArchitraveX, 0, 0],
|
|
1529
1584
|
castShadow: true,
|
|
1530
|
-
material: frontCoverPanelMaterial,
|
|
1585
|
+
material: allMaterials.frontCoverPanelMaterial,
|
|
1531
1586
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1532
|
-
args: [architraveProfileM,
|
|
1587
|
+
args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
|
|
1533
1588
|
})
|
|
1534
1589
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1535
|
-
position: [rightArchitraveX,
|
|
1590
|
+
position: [rightArchitraveX, 0, 0],
|
|
1536
1591
|
castShadow: true,
|
|
1537
|
-
material: frontCoverPanelMaterial,
|
|
1592
|
+
material: allMaterials.frontCoverPanelMaterial,
|
|
1538
1593
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1539
|
-
args: [architraveProfileM,
|
|
1594
|
+
args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
|
|
1540
1595
|
})
|
|
1541
1596
|
})]
|
|
1542
1597
|
}), backCoverPanel.visible && /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
@@ -1544,31 +1599,31 @@ function DoorModels(_ref7) {
|
|
|
1544
1599
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1545
1600
|
position: [0, topArchitraveY, 0],
|
|
1546
1601
|
castShadow: true,
|
|
1547
|
-
material: backCoverPanelMaterial,
|
|
1602
|
+
material: allMaterials.backCoverPanelMaterial,
|
|
1548
1603
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1549
1604
|
args: [topArchitraveWidth, architraveProfileM, architraveDepthM]
|
|
1550
1605
|
})
|
|
1551
1606
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1552
|
-
position: [leftArchitraveX,
|
|
1607
|
+
position: [leftArchitraveX, 0, 0],
|
|
1553
1608
|
castShadow: true,
|
|
1554
|
-
material: backCoverPanelMaterial,
|
|
1609
|
+
material: allMaterials.backCoverPanelMaterial,
|
|
1555
1610
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1556
|
-
args: [architraveProfileM,
|
|
1611
|
+
args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
|
|
1557
1612
|
})
|
|
1558
1613
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1559
|
-
position: [rightArchitraveX,
|
|
1614
|
+
position: [rightArchitraveX, 0, 0],
|
|
1560
1615
|
castShadow: true,
|
|
1561
|
-
material: backCoverPanelMaterial,
|
|
1616
|
+
material: allMaterials.backCoverPanelMaterial,
|
|
1562
1617
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1563
|
-
args: [architraveProfileM,
|
|
1618
|
+
args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
|
|
1564
1619
|
})
|
|
1565
1620
|
})]
|
|
1566
1621
|
}), exteriorFanlight.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1567
|
-
position: [0, exteriorFanlightYPosition,
|
|
1622
|
+
position: [0, exteriorFanlightYPosition, 0],
|
|
1568
1623
|
castShadow: true,
|
|
1569
|
-
material: exteriorFanlightMaterial,
|
|
1624
|
+
material: allMaterials.exteriorFanlightMaterial,
|
|
1570
1625
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1571
|
-
args: [
|
|
1626
|
+
args: [totalOpeningWidthM + sidesFrameWidthM * 2, exteriorFanlightHeightM, exteriorFanlightDepthM]
|
|
1572
1627
|
})
|
|
1573
1628
|
}), isFrameVisible && /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1574
1629
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
@@ -1578,13 +1633,13 @@ function DoorModels(_ref7) {
|
|
|
1578
1633
|
useGroups: true,
|
|
1579
1634
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
1580
1635
|
name: "frame-base",
|
|
1581
|
-
material: frameMaterial,
|
|
1636
|
+
material: allMaterials.frameMaterial,
|
|
1582
1637
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1583
1638
|
args: [totalOpeningWidthM, topFrameWidthM, frameDepthM]
|
|
1584
1639
|
})
|
|
1585
1640
|
}), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
1586
1641
|
name: "cut-exterior",
|
|
1587
|
-
material: frameMaterial,
|
|
1642
|
+
material: allMaterials.frameMaterial,
|
|
1588
1643
|
position: [0, notchposition, 0],
|
|
1589
1644
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1590
1645
|
args: [totalOpeningWidthM + 0.01, notchWidthM, notchDepthM]
|
|
@@ -1598,16 +1653,16 @@ function DoorModels(_ref7) {
|
|
|
1598
1653
|
useGroups: true,
|
|
1599
1654
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
1600
1655
|
name: "frame-base",
|
|
1601
|
-
material: frameMaterial,
|
|
1656
|
+
material: allMaterials.frameMaterial,
|
|
1602
1657
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1603
|
-
args: [sidesFrameWidthM,
|
|
1658
|
+
args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, frameDepthM]
|
|
1604
1659
|
})
|
|
1605
1660
|
}), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
1606
1661
|
name: "cut-exterior",
|
|
1607
|
-
material: frameMaterial,
|
|
1662
|
+
material: allMaterials.frameMaterial,
|
|
1608
1663
|
position: [-notchposition, 0, 0],
|
|
1609
1664
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1610
|
-
args: [notchWidthM,
|
|
1665
|
+
args: [notchWidthM, totalOpeningHeightM + topFrameWidthM + 0.01, notchDepthM]
|
|
1611
1666
|
})
|
|
1612
1667
|
})]
|
|
1613
1668
|
})
|
|
@@ -1618,37 +1673,37 @@ function DoorModels(_ref7) {
|
|
|
1618
1673
|
useGroups: true,
|
|
1619
1674
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
1620
1675
|
name: "frame-base",
|
|
1621
|
-
material: frameMaterial,
|
|
1676
|
+
material: allMaterials.frameMaterial,
|
|
1622
1677
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1623
|
-
args: [sidesFrameWidthM,
|
|
1678
|
+
args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, frameDepthM]
|
|
1624
1679
|
})
|
|
1625
1680
|
}), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
1626
1681
|
name: "cut-exterior",
|
|
1627
|
-
material: frameMaterial,
|
|
1682
|
+
material: allMaterials.frameMaterial,
|
|
1628
1683
|
position: [notchposition, 0, 0],
|
|
1629
1684
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1630
|
-
args: [notchWidthM,
|
|
1685
|
+
args: [notchWidthM, totalOpeningHeightM + topFrameWidthM + 0.01, notchDepthM]
|
|
1631
1686
|
})
|
|
1632
1687
|
})]
|
|
1633
1688
|
})
|
|
1634
1689
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1635
1690
|
castShadow: true,
|
|
1636
1691
|
position: [0, totalOpeningHeightM / 2 - doorStopWidthM / 2, doorStopPositionZ],
|
|
1637
|
-
material: doorStopMaterial,
|
|
1692
|
+
material: allMaterials.doorStopMaterial,
|
|
1638
1693
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1639
1694
|
args: [totalOpeningWidthM, doorStopWidthM, doorStopDepthM]
|
|
1640
1695
|
})
|
|
1641
1696
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1642
1697
|
castShadow: true,
|
|
1643
1698
|
position: [-totalOpeningWidthM / 2 + doorStopWidthM / 2, 0, doorStopPositionZ],
|
|
1644
|
-
material: doorStopMaterial,
|
|
1699
|
+
material: allMaterials.doorStopMaterial,
|
|
1645
1700
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1646
1701
|
args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
|
|
1647
1702
|
})
|
|
1648
1703
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1649
1704
|
castShadow: true,
|
|
1650
1705
|
position: [totalOpeningWidthM / 2 - doorStopWidthM / 2, 0, doorStopPositionZ],
|
|
1651
|
-
material: doorStopMaterial,
|
|
1706
|
+
material: allMaterials.doorStopMaterial,
|
|
1652
1707
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1653
1708
|
args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
|
|
1654
1709
|
})
|
|
@@ -1656,45 +1711,45 @@ function DoorModels(_ref7) {
|
|
|
1656
1711
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1657
1712
|
castShadow: true,
|
|
1658
1713
|
position: [0, topGasketYPosition, gasketZPosition],
|
|
1659
|
-
material: gasketMaterial,
|
|
1714
|
+
material: allMaterials.gasketMaterial,
|
|
1660
1715
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1661
1716
|
args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
|
|
1662
1717
|
})
|
|
1663
1718
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1664
1719
|
castShadow: true,
|
|
1665
1720
|
position: [leftGasketXPosition - 0.005, -0.005, gasketZPosition],
|
|
1666
|
-
material: gasketMaterial,
|
|
1721
|
+
material: allMaterials.gasketMaterial,
|
|
1667
1722
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1668
1723
|
args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.02, gasketDepthM]
|
|
1669
1724
|
})
|
|
1670
1725
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1671
1726
|
castShadow: true,
|
|
1672
1727
|
position: [rightGasketXPosition + 0.005, -0.005, gasketZPosition],
|
|
1673
|
-
material: gasketMaterial,
|
|
1728
|
+
material: allMaterials.gasketMaterial,
|
|
1674
1729
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1675
1730
|
args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.02, gasketDepthM]
|
|
1676
1731
|
})
|
|
1677
1732
|
})]
|
|
1678
|
-
}),
|
|
1733
|
+
}), ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1679
1734
|
children: [/*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1680
1735
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1681
1736
|
castShadow: true,
|
|
1682
1737
|
position: [0, totalOpeningHeightM / 2 - secondDoorStopWidthM / 2, secondDoorStopPositionZ],
|
|
1683
|
-
material: doorStopMaterial,
|
|
1738
|
+
material: allMaterials.doorStopMaterial,
|
|
1684
1739
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1685
1740
|
args: [totalOpeningWidthM, secondDoorStopWidthM, secondDoorStopDepthM]
|
|
1686
1741
|
})
|
|
1687
1742
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1688
1743
|
castShadow: true,
|
|
1689
1744
|
position: [-totalOpeningWidthM / 2 + secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
|
|
1690
|
-
material: doorStopMaterial,
|
|
1745
|
+
material: allMaterials.doorStopMaterial,
|
|
1691
1746
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1692
1747
|
args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
|
|
1693
1748
|
})
|
|
1694
1749
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1695
1750
|
castShadow: true,
|
|
1696
1751
|
position: [totalOpeningWidthM / 2 - secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
|
|
1697
|
-
material: doorStopMaterial,
|
|
1752
|
+
material: allMaterials.doorStopMaterial,
|
|
1698
1753
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1699
1754
|
args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
|
|
1700
1755
|
})
|
|
@@ -1703,77 +1758,77 @@ function DoorModels(_ref7) {
|
|
|
1703
1758
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1704
1759
|
castShadow: true,
|
|
1705
1760
|
position: [0, secondTopGasketYPosition - 0.005, secondGasketZPosition],
|
|
1706
|
-
material: gasketMaterial,
|
|
1761
|
+
material: allMaterials.gasketMaterial,
|
|
1707
1762
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1708
1763
|
args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
|
|
1709
1764
|
})
|
|
1710
1765
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1711
1766
|
castShadow: true,
|
|
1712
1767
|
position: [secondLeftGasketXPosition - 0.005, -0.01, secondGasketZPosition],
|
|
1713
|
-
material: gasketMaterial,
|
|
1768
|
+
material: allMaterials.gasketMaterial,
|
|
1714
1769
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1715
1770
|
args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.04, gasketDepthM]
|
|
1716
1771
|
})
|
|
1717
1772
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1718
1773
|
castShadow: true,
|
|
1719
1774
|
position: [secondRightGasketXPosition + 0.005, -0.01, secondGasketZPosition],
|
|
1720
|
-
material: gasketMaterial,
|
|
1775
|
+
material: allMaterials.gasketMaterial,
|
|
1721
1776
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1722
1777
|
args: [gasketWidthM + 0.004, totalOpeningHeightM - 0.04, gasketDepthM]
|
|
1723
1778
|
})
|
|
1724
1779
|
})]
|
|
1725
1780
|
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1726
1781
|
children: [/*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1727
|
-
children: [
|
|
1782
|
+
children: [["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1728
1783
|
castShadow: true,
|
|
1729
1784
|
position: [0, topFrameCenterY - secondDoorStopWidthM / 2, leftGlass_Z],
|
|
1730
|
-
material: glassInfillMaterial,
|
|
1785
|
+
material: allMaterials.glassInfillMaterial,
|
|
1731
1786
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1732
1787
|
args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM + secondDoorStopWidthM, GlassPanelDepthM]
|
|
1733
1788
|
})
|
|
1734
|
-
}),
|
|
1789
|
+
}), !["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1735
1790
|
castShadow: true,
|
|
1736
1791
|
position: [0, topFrameCenterY, leftGlass_Z],
|
|
1737
|
-
material: glassInfillMaterial,
|
|
1792
|
+
material: allMaterials.glassInfillMaterial,
|
|
1738
1793
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1739
1794
|
args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM, GlassPanelDepthM]
|
|
1740
1795
|
})
|
|
1741
1796
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1742
1797
|
castShadow: true,
|
|
1743
1798
|
position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2 + secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
|
|
1744
|
-
material: glassInfillMaterial,
|
|
1799
|
+
material: allMaterials.glassInfillMaterial,
|
|
1745
1800
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1746
|
-
args: [sidesFrameWidthM + secondDoorStopWidthM,
|
|
1801
|
+
args: [sidesFrameWidthM + secondDoorStopWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
|
|
1747
1802
|
})
|
|
1748
1803
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1749
1804
|
castShadow: true,
|
|
1750
1805
|
position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2 - secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
|
|
1751
|
-
material: glassInfillMaterial,
|
|
1806
|
+
material: allMaterials.glassInfillMaterial,
|
|
1752
1807
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1753
|
-
args: [sidesFrameWidthM + secondDoorStopWidthM,
|
|
1808
|
+
args: [sidesFrameWidthM + secondDoorStopWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
|
|
1754
1809
|
})
|
|
1755
1810
|
})]
|
|
1756
1811
|
}), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1757
1812
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1758
1813
|
castShadow: true,
|
|
1759
1814
|
position: [0, topFrameCenterY, rightGlass_Z],
|
|
1760
|
-
material: glassInfillMaterial,
|
|
1815
|
+
material: allMaterials.glassInfillMaterial,
|
|
1761
1816
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1762
1817
|
args: [totalOpeningWidthM, topFrameWidthM, GlassPanelDepthM]
|
|
1763
1818
|
})
|
|
1764
1819
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1765
1820
|
castShadow: true,
|
|
1766
1821
|
position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
|
|
1767
|
-
material: glassInfillMaterial,
|
|
1822
|
+
material: allMaterials.glassInfillMaterial,
|
|
1768
1823
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1769
|
-
args: [sidesFrameWidthM,
|
|
1824
|
+
args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
|
|
1770
1825
|
})
|
|
1771
1826
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1772
1827
|
castShadow: true,
|
|
1773
1828
|
position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
|
|
1774
|
-
material: glassInfillMaterial,
|
|
1829
|
+
material: allMaterials.glassInfillMaterial,
|
|
1775
1830
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1776
|
-
args: [sidesFrameWidthM,
|
|
1831
|
+
args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
|
|
1777
1832
|
})
|
|
1778
1833
|
})]
|
|
1779
1834
|
})]
|
|
@@ -1782,23 +1837,43 @@ function DoorModels(_ref7) {
|
|
|
1782
1837
|
}), interiorFanlight.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1783
1838
|
position: [0, interiorFanlightYPosition, doorCenterZ],
|
|
1784
1839
|
castShadow: true,
|
|
1785
|
-
material: interiorFanlightMaterial,
|
|
1840
|
+
material: allMaterials.interiorFanlightMaterial,
|
|
1786
1841
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1787
1842
|
args: [totalOpeningWidthM, interiorFanlightHeightM, doorDepthM]
|
|
1788
1843
|
})
|
|
1789
1844
|
}), doorInstances.map(instance => /*#__PURE__*/jsxRuntime.jsx(DoorLeaf, {
|
|
1790
1845
|
pivot: instance.pivot,
|
|
1791
|
-
xOffset: instance.x
|
|
1846
|
+
xOffset: instance.x,
|
|
1847
|
+
materials: allMaterials
|
|
1792
1848
|
}, instance.key))]
|
|
1793
1849
|
})
|
|
1794
1850
|
});
|
|
1795
1851
|
}
|
|
1852
|
+
|
|
1853
|
+
// {
|
|
1854
|
+
// /* DoorLeaf */
|
|
1855
|
+
// }
|
|
1796
1856
|
function DoorLeaf(_ref8) {
|
|
1797
1857
|
let {
|
|
1798
1858
|
pivot,
|
|
1799
|
-
xOffset
|
|
1859
|
+
xOffset,
|
|
1860
|
+
materials
|
|
1800
1861
|
} = _ref8;
|
|
1862
|
+
// Destructure materials from props.
|
|
1801
1863
|
const {
|
|
1864
|
+
doorMaterial,
|
|
1865
|
+
glassInfillMaterial,
|
|
1866
|
+
hingeBodyMaterial,
|
|
1867
|
+
gasketMaterial,
|
|
1868
|
+
occulusInfillMaterial,
|
|
1869
|
+
frontDoorPlaneMaterial,
|
|
1870
|
+
backDoorPlaneMaterial,
|
|
1871
|
+
hingeAccentMaterial
|
|
1872
|
+
} = materials;
|
|
1873
|
+
|
|
1874
|
+
// Get NON-MATERIAL state from the context.
|
|
1875
|
+
const {
|
|
1876
|
+
isFrameVisible,
|
|
1802
1877
|
door,
|
|
1803
1878
|
doorFrame,
|
|
1804
1879
|
interiorFanlight,
|
|
@@ -1809,33 +1884,8 @@ function DoorLeaf(_ref8) {
|
|
|
1809
1884
|
bodyType,
|
|
1810
1885
|
exteriorFanlightType,
|
|
1811
1886
|
glassVisible,
|
|
1812
|
-
|
|
1887
|
+
glassDepth
|
|
1813
1888
|
} = useConfigurator();
|
|
1814
|
-
const pers = React.useMemo(() => {
|
|
1815
|
-
const dynamicMaterials = {};
|
|
1816
|
-
for (const key in materials) {
|
|
1817
|
-
if (Object.prototype.hasOwnProperty.call(materials, key)) {
|
|
1818
|
-
const value = materials[key];
|
|
1819
|
-
dynamicMaterials[key] = createMaterialFromProp(value);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
return dynamicMaterials;
|
|
1823
|
-
}, [materials]);
|
|
1824
|
-
|
|
1825
|
-
// --- Material Logic ---
|
|
1826
|
-
const doorMaterial = React.useMemo(() => placeholderMaterial, []);
|
|
1827
|
-
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterialforFrames, [pers]);
|
|
1828
|
-
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials.black, [pers]);
|
|
1829
|
-
React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || frameMaterial, [pers, frameMaterial]);
|
|
1830
|
-
const occulusInfillMaterial = React.useMemo(() => availableMaterials.glass, []);
|
|
1831
|
-
const glassInfillMaterial = React.useMemo(() => pers.D_FR_COLOR || availableMaterials.glass, [pers]);
|
|
1832
|
-
const hingeBodyMaterial = React.useMemo(() => availableMaterials.aluminum, []);
|
|
1833
|
-
const frontDoorPlaneMaterial = React.useMemo(() => pers.D_SRF_DECOR_2 || placeholderMaterial, [pers]);
|
|
1834
|
-
const backDoorPlaneMaterial = React.useMemo(() => pers.D_SRF_DECOR || placeholderMaterial, [pers]);
|
|
1835
|
-
const hingeAccentMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1836
|
-
color: "#1a1a1a",
|
|
1837
|
-
roughness: 0.1
|
|
1838
|
-
}), []);
|
|
1839
1889
|
|
|
1840
1890
|
// --- Dimension calculations ---
|
|
1841
1891
|
const {
|
|
@@ -1846,27 +1896,21 @@ function DoorLeaf(_ref8) {
|
|
|
1846
1896
|
} = door;
|
|
1847
1897
|
const {
|
|
1848
1898
|
frameDepth,
|
|
1899
|
+
topThk,
|
|
1900
|
+
sidesThk,
|
|
1849
1901
|
doorStopWidth,
|
|
1850
1902
|
doorStopDepth,
|
|
1851
1903
|
doorStopOffset,
|
|
1852
|
-
gasketWidth,
|
|
1853
1904
|
gasketDepth,
|
|
1854
1905
|
secondDoorStopWidth,
|
|
1855
1906
|
secondDoorStopDepth
|
|
1856
1907
|
} = doorFrame;
|
|
1857
1908
|
const initialDoorHeight = React.useRef(null);
|
|
1858
|
-
const initialDoorWidth = React.useRef(null);
|
|
1859
1909
|
React.useEffect(() => {
|
|
1860
1910
|
if (doorHeight > 0 && initialDoorHeight.current === null) {
|
|
1861
1911
|
initialDoorHeight.current = doorHeight;
|
|
1862
1912
|
}
|
|
1863
|
-
|
|
1864
|
-
initialDoorWidth.current = doorWidth;
|
|
1865
|
-
}
|
|
1866
|
-
}, [doorHeight, doorWidth]);
|
|
1867
|
-
const {
|
|
1868
|
-
height: interiorFanlightHeightValue
|
|
1869
|
-
} = interiorFanlight;
|
|
1913
|
+
}, [doorHeight]);
|
|
1870
1914
|
const {
|
|
1871
1915
|
x1: occulusX1,
|
|
1872
1916
|
x2: occulusX2,
|
|
@@ -1874,8 +1918,9 @@ function DoorLeaf(_ref8) {
|
|
|
1874
1918
|
y2: occulusY2,
|
|
1875
1919
|
depth: occulusInfillDepth
|
|
1876
1920
|
} = occulus;
|
|
1877
|
-
const interiorFanlightHeight = interiorFanlight.visible ?
|
|
1921
|
+
const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlight.height : 0;
|
|
1878
1922
|
const mainDoorHeight = doorHeight - interiorFanlightHeight;
|
|
1923
|
+
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
1879
1924
|
|
|
1880
1925
|
// Convert dimensions from mm to meters
|
|
1881
1926
|
const doorWidthM = doorWidth / 1000;
|
|
@@ -1883,6 +1928,7 @@ function DoorLeaf(_ref8) {
|
|
|
1883
1928
|
const totalOpeningHeightM = doorHeight / 1000;
|
|
1884
1929
|
const doorDepthM = theDoorDepth / 1000;
|
|
1885
1930
|
const frameDepthM = frameDepth / 1000;
|
|
1931
|
+
const sidesFrameWidthM = sidesThkValue / 1000;
|
|
1886
1932
|
const occulusX1M = occulusX1 / 1000;
|
|
1887
1933
|
const occulusX2M = occulusX2 / 1000;
|
|
1888
1934
|
const occulusY1M = occulusY1 / 1000;
|
|
@@ -1891,8 +1937,7 @@ function DoorLeaf(_ref8) {
|
|
|
1891
1937
|
const doorStopWidthM = doorStopWidth / 1000;
|
|
1892
1938
|
const doorStopDepthM = doorStopDepth / 1000;
|
|
1893
1939
|
const gasketDepthM = gasketDepth / 1000;
|
|
1894
|
-
const
|
|
1895
|
-
const doorStopOffsetFromEdgeM = doorStopOffsetValue / 1000;
|
|
1940
|
+
const doorStopOffsetFromEdgeM = parseInt(doorStopOffset) / 1000;
|
|
1896
1941
|
const isOpeningIn = doorOpening === "in";
|
|
1897
1942
|
const doorStopPositionZ = React.useMemo(() => isOpeningIn ? frameDepthM / 2 - doorStopOffsetFromEdgeM - doorStopDepthM / 2 : -frameDepthM / 2 + doorStopOffsetFromEdgeM + doorStopDepthM / 2, [isOpeningIn, frameDepthM, doorStopOffsetFromEdgeM, doorStopDepthM]);
|
|
1898
1943
|
const gasketZPosition = React.useMemo(() => isOpeningIn ? doorStopPositionZ - doorStopDepthM / 2 - gasketDepthM / 2 : doorStopPositionZ + doorStopDepthM / 2 + gasketDepthM / 2, [isOpeningIn, doorStopPositionZ, doorStopDepthM, gasketDepthM]);
|
|
@@ -1901,25 +1946,15 @@ function DoorLeaf(_ref8) {
|
|
|
1901
1946
|
const secondDoorStopPositionZ = isOpeningIn ? frameDepthM / 2 - secondDoorStopDepthM / 2 : -frameDepthM / 2 + secondDoorStopDepthM / 2;
|
|
1902
1947
|
const doorCenterZ = React.useMemo(() => {
|
|
1903
1948
|
if (frameType === "WF_FLI") {
|
|
1904
|
-
|
|
1905
|
-
return frameDepthM / 2 - doorDepthM / 2;
|
|
1906
|
-
} else {
|
|
1907
|
-
return -frameDepthM / 2 + doorDepthM / 2;
|
|
1908
|
-
}
|
|
1949
|
+
return isOpeningIn ? frameDepthM / 2 - doorDepthM / 2 : -frameDepthM / 2 + doorDepthM / 2;
|
|
1909
1950
|
}
|
|
1910
|
-
if (
|
|
1951
|
+
if (["WDGF_WDG100", "WF_100"].includes(frameType)) {
|
|
1911
1952
|
return 0;
|
|
1912
|
-
} else {
|
|
1913
|
-
if (isOpeningIn) {
|
|
1914
|
-
const gasketBackFaceZ = gasketZPosition - gasketDepthM / 2;
|
|
1915
|
-
return gasketBackFaceZ - doorDepthM / 2;
|
|
1916
|
-
} else {
|
|
1917
|
-
const gasketFrontFaceZ = gasketZPosition + gasketDepthM / 2;
|
|
1918
|
-
return gasketFrontFaceZ + doorDepthM / 2;
|
|
1919
|
-
}
|
|
1920
1953
|
}
|
|
1954
|
+
const gasketFaceZ = isOpeningIn ? gasketZPosition - gasketDepthM / 2 : gasketZPosition + gasketDepthM / 2;
|
|
1955
|
+
return isOpeningIn ? gasketFaceZ - doorDepthM / 2 : gasketFaceZ + doorDepthM / 2;
|
|
1921
1956
|
}, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
|
|
1922
|
-
const GlassPanelDepthM =
|
|
1957
|
+
const GlassPanelDepthM = glassDepth / 1000;
|
|
1923
1958
|
const frontGlassOffsetZ = doorDepthM / 2 + GlassPanelDepthM / 2;
|
|
1924
1959
|
const backGlassOffsetZ = -doorDepthM / 2 - GlassPanelDepthM / 2;
|
|
1925
1960
|
const occulusWidthM = doorWidthM - occulusX1M - occulusX2M;
|
|
@@ -1928,13 +1963,11 @@ function DoorLeaf(_ref8) {
|
|
|
1928
1963
|
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
1929
1964
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
1930
1965
|
const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
1966
|
+
|
|
1967
|
+
// --- PIVOT ---
|
|
1931
1968
|
const hingeZ = React.useMemo(() => {
|
|
1932
1969
|
if (frameType === "WF_FLI") {
|
|
1933
|
-
|
|
1934
|
-
return doorCenterZ - doorDepthM / 2;
|
|
1935
|
-
} else {
|
|
1936
|
-
return doorCenterZ + doorDepthM / 2;
|
|
1937
|
-
}
|
|
1970
|
+
return isOpeningIn ? doorCenterZ - doorDepthM / 2 : doorCenterZ + doorDepthM / 2;
|
|
1938
1971
|
}
|
|
1939
1972
|
return isOpeningIn ? -frameDepthM / 2 : frameDepthM / 2;
|
|
1940
1973
|
}, [frameType, isOpeningIn, doorCenterZ, doorDepthM, frameDepthM]);
|
|
@@ -1952,6 +1985,8 @@ function DoorLeaf(_ref8) {
|
|
|
1952
1985
|
});
|
|
1953
1986
|
const handleClick = () => setIsOpen(!isOpen);
|
|
1954
1987
|
const doorYPosition = -totalOpeningHeightM / 2 + mainDoorHeightM / 2;
|
|
1988
|
+
|
|
1989
|
+
// Handle positioning logic
|
|
1955
1990
|
const handleCenterYFromDoorBottom = 1.0;
|
|
1956
1991
|
const safeHandleY = Math.min(Math.max(handleCenterYFromDoorBottom, 0.25), mainDoorHeightM - 0.25);
|
|
1957
1992
|
const handleHeightM = -mainDoorHeightM / 2 + safeHandleY;
|
|
@@ -1965,75 +2000,33 @@ function DoorLeaf(_ref8) {
|
|
|
1965
2000
|
const latchMarginM = 0.08;
|
|
1966
2001
|
handleX = nonHingeSideX + (pivot === "left" ? -latchMarginM : latchMarginM);
|
|
1967
2002
|
}
|
|
2003
|
+
|
|
2004
|
+
// Hinge dimension calculations
|
|
1968
2005
|
const hingeTotalHeightM = 120 / 1000;
|
|
1969
2006
|
const hingeRadiusM = 8 / 1000;
|
|
1970
2007
|
const capHeightM = 4 / 1000;
|
|
1971
2008
|
const separatorHeightM = 4 / 1000;
|
|
1972
2009
|
const barrelPartHeight = (hingeTotalHeightM - capHeightM * 2 - separatorHeightM) / 2;
|
|
1973
2010
|
const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
|
|
2011
|
+
|
|
2012
|
+
// Hinge positioning logic
|
|
1974
2013
|
const standardHingeYPositions = React.useMemo(() => {
|
|
1975
2014
|
const numHinges = 4;
|
|
1976
2015
|
const topMargin = 180 / 1000;
|
|
1977
2016
|
const bottomMargin = 180 / 1000;
|
|
1978
2017
|
const availableHeight = mainDoorHeightM - topMargin - bottomMargin;
|
|
1979
2018
|
const spacing = availableHeight / (numHinges - 1);
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
return positions;
|
|
2019
|
+
return Array.from({
|
|
2020
|
+
length: numHinges
|
|
2021
|
+
}, (_, i) => mainDoorHeightM / 2 - topMargin - i * spacing);
|
|
1985
2022
|
}, [mainDoorHeightM]);
|
|
1986
2023
|
const glassHingeYPositions = React.useMemo(() => {
|
|
1987
|
-
|
|
1988
|
-
const secondTopMargin = 450 / 1000;
|
|
1989
|
-
const bottomMargin = 250 / 1000;
|
|
1990
|
-
const top = mainDoorHeightM / 2 - topMargin;
|
|
1991
|
-
const secondTop = mainDoorHeightM / 2 - secondTopMargin;
|
|
1992
|
-
const bottom = -mainDoorHeightM / 2 + bottomMargin;
|
|
1993
|
-
return [top, secondTop, bottom];
|
|
2024
|
+
return [mainDoorHeightM / 2 - 250 / 1000, mainDoorHeightM / 2 - 450 / 1000, -mainDoorHeightM / 2 + 250 / 1000];
|
|
1994
2025
|
}, [mainDoorHeightM]);
|
|
1995
2026
|
const isStandardHingeVisible = React.useMemo(() => {
|
|
1996
|
-
if (isGlassDoor) return false;
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
return false;
|
|
2000
|
-
}
|
|
2001
|
-
return true;
|
|
2002
|
-
}, [frameType, isGlassDoor]);
|
|
2003
|
-
|
|
2004
|
-
// --- DYNAMIC TEXTURE MATERIALS ---
|
|
2005
|
-
React.useEffect(() => {
|
|
2006
|
-
// This effect runs when the material or dimensions change
|
|
2007
|
-
if (frontDoorPlaneMaterial.map) {
|
|
2008
|
-
const texture = frontDoorPlaneMaterial.map;
|
|
2009
|
-
|
|
2010
|
-
// Ensure the texture repeats
|
|
2011
|
-
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
2012
|
-
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
2013
|
-
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2014
|
-
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2015
|
-
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2016
|
-
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2017
|
-
texture.repeat.set(repeatX, repeatY * 2);
|
|
2018
|
-
|
|
2019
|
-
// Tell Three.js the texture needs to be updated
|
|
2020
|
-
texture.needsUpdate = true;
|
|
2021
|
-
}
|
|
2022
|
-
}, [frontDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2023
|
-
React.useEffect(() => {
|
|
2024
|
-
// Same logic for the back material
|
|
2025
|
-
if (backDoorPlaneMaterial.map) {
|
|
2026
|
-
const texture = backDoorPlaneMaterial.map;
|
|
2027
|
-
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
2028
|
-
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
2029
|
-
const initialHeightM = initialDoorHeight.current ? initialDoorHeight.current / 1000 : mainDoorHeightM;
|
|
2030
|
-
const initialWidthM = initialDoorWidth.current ? initialDoorWidth.current / 1000 : doorWidthM;
|
|
2031
|
-
const repeatY = initialHeightM > 0 ? mainDoorHeightM / initialHeightM : 1;
|
|
2032
|
-
const repeatX = initialWidthM > 0 ? doorWidthM / initialWidthM : 1;
|
|
2033
|
-
texture.repeat.set(repeatX, repeatY * 2);
|
|
2034
|
-
texture.needsUpdate = true;
|
|
2035
|
-
}
|
|
2036
|
-
}, [backDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2027
|
+
if (isGlassDoor || !isFrameVisible) return false;
|
|
2028
|
+
return !["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType);
|
|
2029
|
+
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
2037
2030
|
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2038
2031
|
"position-x": xOffset,
|
|
2039
2032
|
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
@@ -2083,10 +2076,10 @@ function DoorLeaf(_ref8) {
|
|
|
2083
2076
|
args: [hingeRadiusM, hingeRadiusM, separatorHeightM, 32]
|
|
2084
2077
|
})
|
|
2085
2078
|
})]
|
|
2086
|
-
}, "door-hinge-".concat(index))), isGlassDoor && glassHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsx(GlassHinge, {
|
|
2079
|
+
}, "door-hinge-".concat(index))), isGlassDoor && isFrameVisible && glassHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsx(GlassHinge, {
|
|
2087
2080
|
position: [0, y, doorOffsetZ + 0.0001],
|
|
2088
2081
|
pivot: pivot,
|
|
2089
|
-
frameSideWidth:
|
|
2082
|
+
frameSideWidth: sidesFrameWidthM,
|
|
2090
2083
|
doorDepthM: doorDepthM,
|
|
2091
2084
|
material: hingeBodyMaterial,
|
|
2092
2085
|
gasketMaterial: gasketMaterial
|
|
@@ -2104,7 +2097,7 @@ function DoorLeaf(_ref8) {
|
|
|
2104
2097
|
args: [doorWidthM, mainDoorHeightM, doorDepthM]
|
|
2105
2098
|
})
|
|
2106
2099
|
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
2107
|
-
visible:
|
|
2100
|
+
visible: ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType),
|
|
2108
2101
|
width: doorWidthM,
|
|
2109
2102
|
height: totalOpeningHeightM,
|
|
2110
2103
|
stopWidth: doorStopWidthM,
|
|
@@ -2114,7 +2107,7 @@ function DoorLeaf(_ref8) {
|
|
|
2114
2107
|
material: doorMaterial,
|
|
2115
2108
|
setName: "1"
|
|
2116
2109
|
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
2117
|
-
visible:
|
|
2110
|
+
visible: ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType),
|
|
2118
2111
|
width: doorWidthM,
|
|
2119
2112
|
height: totalOpeningHeightM,
|
|
2120
2113
|
stopWidth: secondDoorStopWidthM,
|
|
@@ -2123,37 +2116,36 @@ function DoorLeaf(_ref8) {
|
|
|
2123
2116
|
centerZ: doorCenterZ,
|
|
2124
2117
|
material: doorMaterial,
|
|
2125
2118
|
setName: "2"
|
|
2126
|
-
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2127
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2128
|
-
position: [0, 0, frontGlassOffsetZ],
|
|
2129
|
-
castShadow: true,
|
|
2130
|
-
material: glassInfillMaterial,
|
|
2131
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2132
|
-
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2133
|
-
})
|
|
2134
|
-
}), frameType !== "WDGF_WDG100" && frameType !== "WF_100" && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2135
|
-
position: [0, 0, backGlassOffsetZ],
|
|
2136
|
-
castShadow: true,
|
|
2137
|
-
material: glassInfillMaterial,
|
|
2138
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2139
|
-
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2140
|
-
})
|
|
2141
|
-
}), (frameType === "WDGF_WDG100" || frameType === "WF_100") && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2142
|
-
position: [0, -secondDoorStopWidthM / 2, backGlassOffsetZ],
|
|
2143
|
-
castShadow: true,
|
|
2144
|
-
material: glassInfillMaterial,
|
|
2145
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2146
|
-
args: [doorWidthM - 2 * secondDoorStopWidthM, mainDoorHeightM - secondDoorStopWidthM, GlassPanelDepthM]
|
|
2147
|
-
})
|
|
2148
|
-
})]
|
|
2149
2119
|
}), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
2150
|
-
material: placeholderMaterial,
|
|
2151
2120
|
position: [occulusPositionXM, occulusPositionYM, 0],
|
|
2152
2121
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2153
2122
|
args: [occulusWidthM, occulusHeightM, doorDepthM + 0.01]
|
|
2154
2123
|
})
|
|
2155
2124
|
})]
|
|
2156
2125
|
})
|
|
2126
|
+
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2127
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2128
|
+
position: [0, 0, frontGlassOffsetZ],
|
|
2129
|
+
castShadow: true,
|
|
2130
|
+
material: glassInfillMaterial,
|
|
2131
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2132
|
+
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2133
|
+
})
|
|
2134
|
+
}), !["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2135
|
+
position: [0, 0, backGlassOffsetZ],
|
|
2136
|
+
castShadow: true,
|
|
2137
|
+
material: glassInfillMaterial,
|
|
2138
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2139
|
+
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2140
|
+
})
|
|
2141
|
+
}), ["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2142
|
+
position: [0, -secondDoorStopWidthM / 2, backGlassOffsetZ],
|
|
2143
|
+
castShadow: true,
|
|
2144
|
+
material: glassInfillMaterial,
|
|
2145
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2146
|
+
args: [doorWidthM - 2 * secondDoorStopWidthM, mainDoorHeightM - secondDoorStopWidthM, GlassPanelDepthM]
|
|
2147
|
+
})
|
|
2148
|
+
})]
|
|
2157
2149
|
}), frontDoorPlane.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2158
2150
|
position: [0, 0, doorDepthM / 2 + 0.0005],
|
|
2159
2151
|
castShadow: true,
|
|
@@ -2210,12 +2202,11 @@ function DoorLeaf(_ref8) {
|
|
|
2210
2202
|
const DoorConfigurator = _ref => {
|
|
2211
2203
|
let {
|
|
2212
2204
|
doorName,
|
|
2213
|
-
|
|
2214
|
-
|
|
2205
|
+
showInterface = true,
|
|
2206
|
+
is2D = false
|
|
2215
2207
|
} = _ref;
|
|
2216
2208
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2217
2209
|
initialIs2D: is2D,
|
|
2218
|
-
initialMaterials: materials,
|
|
2219
2210
|
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
2220
2211
|
doorName: doorName
|
|
2221
2212
|
})
|