door_models 5.0.6 → 5.0.7
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 +528 -244
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +528 -244
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -110,6 +110,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
110
110
|
const [totalWidth, setTotalWidth] = React.useState(974);
|
|
111
111
|
const [glassVisible, setGlassVisible] = React.useState(false);
|
|
112
112
|
const [glassDepth, setGlassDepth] = React.useState(8);
|
|
113
|
+
const [isDoubleDoor, setIsDoubleDoor] = React.useState(false);
|
|
113
114
|
const [door, setDoor] = React.useState({
|
|
114
115
|
doorMaterial: "door_material",
|
|
115
116
|
doorWidth: 0,
|
|
@@ -174,6 +175,14 @@ const ConfiguratorProvider = _ref => {
|
|
|
174
175
|
depth: 12,
|
|
175
176
|
material: "back_cover_material"
|
|
176
177
|
});
|
|
178
|
+
const [frontDoorPlane, setFrontDoorPlane] = React.useState({
|
|
179
|
+
visible: true,
|
|
180
|
+
material: "test_material"
|
|
181
|
+
});
|
|
182
|
+
const [backDoorPlane, setBackDoorPlane] = React.useState({
|
|
183
|
+
visible: true,
|
|
184
|
+
material: "test_material"
|
|
185
|
+
});
|
|
177
186
|
const [glass, setGlass] = React.useState({
|
|
178
187
|
visible: false,
|
|
179
188
|
material: "infill_material",
|
|
@@ -193,6 +202,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
193
202
|
const [testHingeMaterial, setTestHingeMaterial] = React.useState("metal");
|
|
194
203
|
const [testFrontCoverPanelMaterial, setTestFrontCoverPanelMaterial] = React.useState("aluminum");
|
|
195
204
|
const [testBackCoverPanelMaterial, setTestBackCoverPanelMaterial] = React.useState("aluminum");
|
|
205
|
+
const [testFrontDoorPlaneMaterial, setTestFrontDoorPlaneMaterial] = React.useState("aluminumExtraBrighter");
|
|
206
|
+
const [testBackDoorPlaneMaterial, setTestBackDoorPlaneMaterial] = React.useState("aluminumExtraBrighter");
|
|
196
207
|
const doorHeight = 0;
|
|
197
208
|
const [newPivotPosition, setNewPivotPosition] = React.useState(0);
|
|
198
209
|
const [parseMessage, setParseMessage] = React.useState({
|
|
@@ -203,8 +214,6 @@ const ConfiguratorProvider = _ref => {
|
|
|
203
214
|
setIs2D(initialIs2D);
|
|
204
215
|
}, [initialIs2D]);
|
|
205
216
|
const handleParseCpid = React.useCallback(cpidToParse => {
|
|
206
|
-
setTotalHeight(2700);
|
|
207
|
-
setTotalWidth(974);
|
|
208
217
|
const showMessage = function (text) {
|
|
209
218
|
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
|
|
210
219
|
setParseMessage({
|
|
@@ -237,9 +246,16 @@ const ConfiguratorProvider = _ref => {
|
|
|
237
246
|
|
|
238
247
|
// Door Type
|
|
239
248
|
if (parts[currentIndex] === "SD") {
|
|
249
|
+
setIsDoubleDoor(false);
|
|
250
|
+
setTotalHeight(2700);
|
|
251
|
+
setTotalWidth(974);
|
|
252
|
+
currentIndex++;
|
|
253
|
+
} else if (parts[currentIndex] === "DD") {
|
|
254
|
+
setIsDoubleDoor(true);
|
|
255
|
+
setTotalWidth(1802);
|
|
240
256
|
currentIndex++;
|
|
241
257
|
} else {
|
|
242
|
-
showMessage("Unsupported Door Type: Only 'SD' is supported.");
|
|
258
|
+
showMessage("Unsupported Door Type: Only 'SD' or 'DD' is supported.");
|
|
243
259
|
return;
|
|
244
260
|
}
|
|
245
261
|
|
|
@@ -321,7 +337,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
321
337
|
visible: newConfig.occulusVisible
|
|
322
338
|
}));
|
|
323
339
|
showMessage("Configuration Applied!", "success");
|
|
324
|
-
}, [setBodyType, setExteriorFanlight, setExteriorFanlightType, setFrameType, setInteriorFanlight, setOcculus]);
|
|
340
|
+
}, [setBodyType, setExteriorFanlight, setExteriorFanlightType, setFrameType, setInteriorFanlight, setOcculus, setIsDoubleDoor, setTotalWidth]);
|
|
325
341
|
|
|
326
342
|
// --- BodyType Effect ---
|
|
327
343
|
React.useEffect(() => {
|
|
@@ -650,11 +666,12 @@ const ConfiguratorProvider = _ref => {
|
|
|
650
666
|
}, [totalHeight, doorFrame.topThk, exteriorFanlight.visible, exteriorFanlight.height]);
|
|
651
667
|
React.useEffect(() => {
|
|
652
668
|
const sidesThkValue = parseInt(doorFrame.sidesThk) || 0;
|
|
653
|
-
const
|
|
669
|
+
const numDoors = isDoubleDoor ? 2 : 1;
|
|
670
|
+
const newDoorWidth = (totalWidth - sidesThkValue * 2) / numDoors;
|
|
654
671
|
setDoor(prevDoor => _objectSpread2(_objectSpread2({}, prevDoor), {}, {
|
|
655
672
|
doorWidth: newDoorWidth > 0 ? newDoorWidth : 0
|
|
656
673
|
}));
|
|
657
|
-
}, [totalWidth, doorFrame.sidesThk]);
|
|
674
|
+
}, [totalWidth, doorFrame.sidesThk, isDoubleDoor]);
|
|
658
675
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorContext.Provider, {
|
|
659
676
|
value: {
|
|
660
677
|
is2D,
|
|
@@ -679,6 +696,10 @@ const ConfiguratorProvider = _ref => {
|
|
|
679
696
|
setFrontCoverPanel,
|
|
680
697
|
backCoverPanel,
|
|
681
698
|
setBackCoverPanel,
|
|
699
|
+
frontDoorPlane,
|
|
700
|
+
setFrontDoorPlane,
|
|
701
|
+
backDoorPlane,
|
|
702
|
+
setBackDoorPlane,
|
|
682
703
|
glass,
|
|
683
704
|
setGlass,
|
|
684
705
|
frameType,
|
|
@@ -713,6 +734,10 @@ const ConfiguratorProvider = _ref => {
|
|
|
713
734
|
setTestFrontCoverPanelMaterial,
|
|
714
735
|
testBackCoverPanelMaterial,
|
|
715
736
|
setTestBackCoverPanelMaterial,
|
|
737
|
+
testFrontDoorPlaneMaterial,
|
|
738
|
+
setTestFrontDoorPlaneMaterial,
|
|
739
|
+
testBackDoorPlaneMaterial,
|
|
740
|
+
setTestBackDoorPlaneMaterial,
|
|
716
741
|
glassVisible,
|
|
717
742
|
setGlassVisible,
|
|
718
743
|
glassDepth,
|
|
@@ -720,7 +745,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
720
745
|
handleParseCpid,
|
|
721
746
|
newPivotPosition,
|
|
722
747
|
setNewPivotPosition,
|
|
723
|
-
doorHeight
|
|
748
|
+
doorHeight,
|
|
749
|
+
isDoubleDoor,
|
|
750
|
+
setIsDoubleDoor
|
|
724
751
|
},
|
|
725
752
|
children: children
|
|
726
753
|
});
|
|
@@ -806,6 +833,10 @@ const availableMaterials = {
|
|
|
806
833
|
transparent: true,
|
|
807
834
|
opacity: 0.9,
|
|
808
835
|
envMapIntensity: 1.5
|
|
836
|
+
}),
|
|
837
|
+
test_material: new THREE__namespace.MeshStandardMaterial({
|
|
838
|
+
color: "red",
|
|
839
|
+
roughness: 0.1
|
|
809
840
|
})
|
|
810
841
|
};
|
|
811
842
|
|
|
@@ -845,7 +876,6 @@ function StandardHandle(_ref) {
|
|
|
845
876
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
846
877
|
material: availableMaterials.aluminum,
|
|
847
878
|
castShadow: true,
|
|
848
|
-
receiveShadow: true,
|
|
849
879
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
850
880
|
args: [roseRadius * 2, roseRadius * 2, roseThickness]
|
|
851
881
|
})
|
|
@@ -854,7 +884,6 @@ function StandardHandle(_ref) {
|
|
|
854
884
|
rotation: [Math.PI / 2, Math.PI / 2, 0],
|
|
855
885
|
material: availableMaterials.aluminum,
|
|
856
886
|
castShadow: true,
|
|
857
|
-
receiveShadow: true,
|
|
858
887
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
859
888
|
args: [roseRadius, roseRadius, roseThickness, 32, 1, false, 0, Math.PI]
|
|
860
889
|
})
|
|
@@ -863,7 +892,6 @@ function StandardHandle(_ref) {
|
|
|
863
892
|
rotation: [-Math.PI / 2, Math.PI / 2, 0],
|
|
864
893
|
material: availableMaterials.aluminum,
|
|
865
894
|
castShadow: true,
|
|
866
|
-
receiveShadow: true,
|
|
867
895
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
868
896
|
args: [roseRadius, roseRadius, roseThickness, 32, 1, false, 0, Math.PI]
|
|
869
897
|
})
|
|
@@ -876,7 +904,6 @@ function StandardHandle(_ref) {
|
|
|
876
904
|
"position-z": z,
|
|
877
905
|
material: availableMaterials.aluminum,
|
|
878
906
|
castShadow: true,
|
|
879
|
-
receiveShadow: true,
|
|
880
907
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
881
908
|
args: [roseRadius, roseRadius, roseThickness, 48]
|
|
882
909
|
})
|
|
@@ -886,7 +913,6 @@ function StandardHandle(_ref) {
|
|
|
886
913
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
887
914
|
material: availableMaterials.aluminum,
|
|
888
915
|
castShadow: true,
|
|
889
|
-
receiveShadow: true,
|
|
890
916
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
891
917
|
args: [(roseRadius - 0.008) * 2, (roseRadius - 0.008) * 2, roseThickness]
|
|
892
918
|
})
|
|
@@ -895,7 +921,6 @@ function StandardHandle(_ref) {
|
|
|
895
921
|
rotation: [Math.PI / 2, Math.PI / 2, 0],
|
|
896
922
|
material: availableMaterials.aluminum,
|
|
897
923
|
castShadow: true,
|
|
898
|
-
receiveShadow: true,
|
|
899
924
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
900
925
|
args: [roseRadius - 0.008, roseRadius - 0.008, roseThickness, 32, 1, false, 0, Math.PI]
|
|
901
926
|
})
|
|
@@ -904,7 +929,6 @@ function StandardHandle(_ref) {
|
|
|
904
929
|
rotation: [-Math.PI / 2, Math.PI / 2, 0],
|
|
905
930
|
material: availableMaterials.aluminum,
|
|
906
931
|
castShadow: true,
|
|
907
|
-
receiveShadow: true,
|
|
908
932
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
909
933
|
args: [roseRadius - 0.008, roseRadius - 0.008, roseThickness, 32, 1, false, 0, Math.PI]
|
|
910
934
|
})
|
|
@@ -915,7 +939,6 @@ function StandardHandle(_ref) {
|
|
|
915
939
|
"position-y": -(0.08 + roseGapY),
|
|
916
940
|
material: availableMaterials.aluminum,
|
|
917
941
|
castShadow: true,
|
|
918
|
-
receiveShadow: true,
|
|
919
942
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
920
943
|
args: [roseRadius, roseRadius, roseThickness, 48]
|
|
921
944
|
})
|
|
@@ -925,7 +948,6 @@ function StandardHandle(_ref) {
|
|
|
925
948
|
z + (z > 0 ? roseThickness : -roseThickness) // 👈 accounts for thickness
|
|
926
949
|
],
|
|
927
950
|
castShadow: true,
|
|
928
|
-
receiveShadow: true,
|
|
929
951
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
930
952
|
rotation: [Math.PI / 2, 0, 0],
|
|
931
953
|
position: [0, 0.0075, 0],
|
|
@@ -949,7 +971,6 @@ function StandardHandle(_ref) {
|
|
|
949
971
|
position: [0, 0, faceZ + roseThickness + connectorLength / 2],
|
|
950
972
|
rotation: [Math.PI / 2, 0, 0],
|
|
951
973
|
castShadow: true,
|
|
952
|
-
receiveShadow: true,
|
|
953
974
|
material: availableMaterials.aluminum,
|
|
954
975
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
955
976
|
args: [handleRadius, handleRadius, connectorLength, 48]
|
|
@@ -957,7 +978,6 @@ function StandardHandle(_ref) {
|
|
|
957
978
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
958
979
|
position: [0, 0, cornerFrontZ],
|
|
959
980
|
castShadow: true,
|
|
960
|
-
receiveShadow: true,
|
|
961
981
|
material: availableMaterials.aluminum,
|
|
962
982
|
children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
|
|
963
983
|
args: [handleRadius, 32, 32]
|
|
@@ -966,7 +986,6 @@ function StandardHandle(_ref) {
|
|
|
966
986
|
position: [handleLength / 2, 0, cornerFrontZ],
|
|
967
987
|
rotation: [0, 0, Math.PI / 2],
|
|
968
988
|
castShadow: true,
|
|
969
|
-
receiveShadow: true,
|
|
970
989
|
material: availableMaterials.aluminum,
|
|
971
990
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
972
991
|
args: [handleRadius, handleRadius, handleLength, 48]
|
|
@@ -978,7 +997,6 @@ function StandardHandle(_ref) {
|
|
|
978
997
|
position: [0, 0, -faceZ - roseThickness - connectorLength / 2],
|
|
979
998
|
rotation: [Math.PI / 2, 0, 0],
|
|
980
999
|
castShadow: true,
|
|
981
|
-
receiveShadow: true,
|
|
982
1000
|
material: availableMaterials.aluminum,
|
|
983
1001
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
984
1002
|
args: [handleRadius, handleRadius, connectorLength, 48]
|
|
@@ -986,7 +1004,6 @@ function StandardHandle(_ref) {
|
|
|
986
1004
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
987
1005
|
position: [0, 0, cornerBackZ],
|
|
988
1006
|
castShadow: true,
|
|
989
|
-
receiveShadow: true,
|
|
990
1007
|
material: availableMaterials.aluminum,
|
|
991
1008
|
children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
|
|
992
1009
|
args: [handleRadius, 32, 32]
|
|
@@ -995,7 +1012,6 @@ function StandardHandle(_ref) {
|
|
|
995
1012
|
position: [handleLength / 2, 0, cornerBackZ],
|
|
996
1013
|
rotation: [0, 0, Math.PI / 2],
|
|
997
1014
|
castShadow: true,
|
|
998
|
-
receiveShadow: true,
|
|
999
1015
|
material: availableMaterials.aluminum,
|
|
1000
1016
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1001
1017
|
args: [handleRadius, handleRadius, handleLength, 48]
|
|
@@ -1039,8 +1055,7 @@ const MergedPlate = _ref2 => {
|
|
|
1039
1055
|
children: /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1040
1056
|
geometry: geometry,
|
|
1041
1057
|
material: plateMaterial,
|
|
1042
|
-
castShadow: true
|
|
1043
|
-
receiveShadow: true
|
|
1058
|
+
castShadow: true
|
|
1044
1059
|
})
|
|
1045
1060
|
});
|
|
1046
1061
|
};
|
|
@@ -1065,14 +1080,12 @@ function GlassHandle(_ref3) {
|
|
|
1065
1080
|
"position-z": z + (z > 0 ? roseThickness : -roseThickness) + 0.002,
|
|
1066
1081
|
material: availableMaterials.aluminum,
|
|
1067
1082
|
castShadow: true,
|
|
1068
|
-
receiveShadow: true,
|
|
1069
1083
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1070
1084
|
args: [roseRadius, roseRadius, roseThickness, 48]
|
|
1071
1085
|
})
|
|
1072
1086
|
}), /*#__PURE__*/jsxRuntime.jsxs("mesh", {
|
|
1073
1087
|
position: [0, -0.08, z + (z > 0 ? roseThickness : -roseThickness)],
|
|
1074
1088
|
castShadow: true,
|
|
1075
|
-
receiveShadow: true,
|
|
1076
1089
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1077
1090
|
rotation: [Math.PI / 2, 0, 0],
|
|
1078
1091
|
position: [0, 0.0075, 0],
|
|
@@ -1100,7 +1113,6 @@ function GlassHandle(_ref3) {
|
|
|
1100
1113
|
rotation: [0, 0, Math.PI / 2],
|
|
1101
1114
|
material: availableMaterials.aluminum,
|
|
1102
1115
|
castShadow: true,
|
|
1103
|
-
receiveShadow: true,
|
|
1104
1116
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1105
1117
|
args: [handleRadius, handleRadius, handleLength, 48]
|
|
1106
1118
|
})
|
|
@@ -1109,7 +1121,6 @@ function GlassHandle(_ref3) {
|
|
|
1109
1121
|
rotation: [Math.PI / 2, 0, 0],
|
|
1110
1122
|
material: availableMaterials.aluminum,
|
|
1111
1123
|
castShadow: true,
|
|
1112
|
-
receiveShadow: true,
|
|
1113
1124
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1114
1125
|
args: [handleRadius, handleRadius, connectorLength, 48]
|
|
1115
1126
|
})
|
|
@@ -1117,7 +1128,6 @@ function GlassHandle(_ref3) {
|
|
|
1117
1128
|
position: [0, 0, faceZ + connectorLength],
|
|
1118
1129
|
material: availableMaterials.aluminum,
|
|
1119
1130
|
castShadow: true,
|
|
1120
|
-
receiveShadow: true,
|
|
1121
1131
|
children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
|
|
1122
1132
|
args: [handleRadius, 32, 32]
|
|
1123
1133
|
})
|
|
@@ -1128,7 +1138,6 @@ function GlassHandle(_ref3) {
|
|
|
1128
1138
|
rotation: [0, 0, Math.PI / 2],
|
|
1129
1139
|
material: availableMaterials.aluminum,
|
|
1130
1140
|
castShadow: true,
|
|
1131
|
-
receiveShadow: true,
|
|
1132
1141
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1133
1142
|
args: [handleRadius, handleRadius, handleLength, 48]
|
|
1134
1143
|
})
|
|
@@ -1137,7 +1146,6 @@ function GlassHandle(_ref3) {
|
|
|
1137
1146
|
rotation: [Math.PI / 2, 0, 0],
|
|
1138
1147
|
material: availableMaterials.aluminum,
|
|
1139
1148
|
castShadow: true,
|
|
1140
|
-
receiveShadow: true,
|
|
1141
1149
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1142
1150
|
args: [handleRadius, handleRadius, connectorLength, 48]
|
|
1143
1151
|
})
|
|
@@ -1145,7 +1153,6 @@ function GlassHandle(_ref3) {
|
|
|
1145
1153
|
position: [0, 0, -(faceZ + connectorLength)],
|
|
1146
1154
|
material: availableMaterials.aluminum,
|
|
1147
1155
|
castShadow: true,
|
|
1148
|
-
receiveShadow: true,
|
|
1149
1156
|
children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
|
|
1150
1157
|
args: [handleRadius, 32, 32]
|
|
1151
1158
|
})
|
|
@@ -1211,7 +1218,6 @@ function GlassHinge(_ref5) {
|
|
|
1211
1218
|
"position-z": -(doorDepthM / 2) - plateThickness / 2 - gasketThickness,
|
|
1212
1219
|
material: material,
|
|
1213
1220
|
castShadow: true,
|
|
1214
|
-
receiveShadow: true,
|
|
1215
1221
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1216
1222
|
args: [plateWidth, plateHeight, plateThickness]
|
|
1217
1223
|
})
|
|
@@ -1219,14 +1225,12 @@ function GlassHinge(_ref5) {
|
|
|
1219
1225
|
"position-z": -(doorDepthM / 2) - gasketThickness / 2,
|
|
1220
1226
|
material: gasketMaterial,
|
|
1221
1227
|
castShadow: true,
|
|
1222
|
-
receiveShadow: true,
|
|
1223
1228
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1224
1229
|
args: [plateWidth, plateHeight, gasketThickness]
|
|
1225
1230
|
})
|
|
1226
1231
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1227
1232
|
"position-z": doorDepthM / 2 + plateThickness / 2 + gasketThickness,
|
|
1228
1233
|
castShadow: true,
|
|
1229
|
-
receiveShadow: true,
|
|
1230
1234
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
1231
1235
|
useGroups: true,
|
|
1232
1236
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
@@ -1252,7 +1256,6 @@ function GlassHinge(_ref5) {
|
|
|
1252
1256
|
"position-z": doorDepthM / 2 + gasketThickness / 2,
|
|
1253
1257
|
material: gasketMaterial,
|
|
1254
1258
|
castShadow: true,
|
|
1255
|
-
receiveShadow: true,
|
|
1256
1259
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1257
1260
|
args: [plateWidth, plateHeight, gasketThickness]
|
|
1258
1261
|
})
|
|
@@ -1317,6 +1320,8 @@ function DoorModels(_ref7) {
|
|
|
1317
1320
|
glass,
|
|
1318
1321
|
frontCoverPanel,
|
|
1319
1322
|
backCoverPanel,
|
|
1323
|
+
frontDoorPlane,
|
|
1324
|
+
backDoorPlane,
|
|
1320
1325
|
frameType,
|
|
1321
1326
|
bodyType,
|
|
1322
1327
|
exteriorFanlightType,
|
|
@@ -1332,9 +1337,12 @@ function DoorModels(_ref7) {
|
|
|
1332
1337
|
glassVisible,
|
|
1333
1338
|
testFrontCoverPanelMaterial,
|
|
1334
1339
|
testBackCoverPanelMaterial,
|
|
1340
|
+
testFrontDoorPlaneMaterial,
|
|
1341
|
+
testBackDoorPlaneMaterial,
|
|
1335
1342
|
glassDepth,
|
|
1336
1343
|
cpid,
|
|
1337
|
-
handleParseCpid
|
|
1344
|
+
handleParseCpid,
|
|
1345
|
+
isDoubleDoor
|
|
1338
1346
|
} = useConfigurator();
|
|
1339
1347
|
React.useEffect(() => {
|
|
1340
1348
|
if (doorName) {
|
|
@@ -1370,9 +1378,15 @@ function DoorModels(_ref7) {
|
|
|
1370
1378
|
const {
|
|
1371
1379
|
material: backCoverPanelMaterialName
|
|
1372
1380
|
} = backCoverPanel;
|
|
1381
|
+
const {
|
|
1382
|
+
material: frontDoorPlaneMaterialName
|
|
1383
|
+
} = frontDoorPlane;
|
|
1384
|
+
const {
|
|
1385
|
+
material: backDoorPlaneMaterialName
|
|
1386
|
+
} = backDoorPlane;
|
|
1373
1387
|
|
|
1374
1388
|
// --- Material Logic ---
|
|
1375
|
-
|
|
1389
|
+
React.useMemo(() => availableMaterials[testDoorMaterial] || availableMaterials[doorMaterialName] || placeholderMaterial, [testDoorMaterial, doorMaterialName]);
|
|
1376
1390
|
const frameMaterial = React.useMemo(() => availableMaterials[testFrameMaterial] || availableMaterials[frameMaterialName] || placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
1377
1391
|
const gasketMaterial = React.useMemo(() => availableMaterials[testGasketMaterial] || availableMaterials[gasketMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
1378
1392
|
color: "#111111"
|
|
@@ -1382,16 +1396,18 @@ function DoorModels(_ref7) {
|
|
|
1382
1396
|
}, [testDoorStopMaterial, doorStopMaterialName, frameType, frameMaterial]);
|
|
1383
1397
|
const interiorFanlightMaterial = React.useMemo(() => availableMaterials[testInteriorFanlightMaterial] || availableMaterials[interiorFanlightMaterialName] || placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
1384
1398
|
const exteriorFanlightMaterial = React.useMemo(() => availableMaterials[testExteriorFanlightMaterial] || availableMaterials[exteriorFanlightMaterialName] || placeholderMaterial, [testExteriorFanlightMaterial, exteriorFanlightMaterialName]);
|
|
1385
|
-
|
|
1399
|
+
React.useMemo(() => availableMaterials[testOcculusInfillMaterial] || availableMaterials[occulusInfillMaterialName] || placeholderMaterial, [testOcculusInfillMaterial, occulusInfillMaterialName]);
|
|
1386
1400
|
const glassInfillMaterial = React.useMemo(() => availableMaterials[testGlassInfillMaterial] || availableMaterials[glassInfillMaterialName] || placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
1387
|
-
|
|
1401
|
+
React.useMemo(() => availableMaterials[testHingeMaterial] || availableMaterials[hingeMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
1388
1402
|
color: "#d4d4d4",
|
|
1389
1403
|
metalness: 1.0,
|
|
1390
1404
|
roughness: 0.4
|
|
1391
1405
|
}), [testHingeMaterial, hingeMaterialName]);
|
|
1392
1406
|
const frontCoverPanelMaterial = React.useMemo(() => availableMaterials[testFrontCoverPanelMaterial] || availableMaterials[frontCoverPanelMaterialName] || placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
1393
1407
|
const backCoverPanelMaterial = React.useMemo(() => availableMaterials[testBackCoverPanelMaterial] || availableMaterials[backCoverPanelMaterialName] || placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
1394
|
-
|
|
1408
|
+
React.useMemo(() => availableMaterials[testFrontDoorPlaneMaterial] || availableMaterials[frontDoorPlaneMaterialName] || placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
1409
|
+
React.useMemo(() => availableMaterials[testBackDoorPlaneMaterial] || availableMaterials[backDoorPlaneMaterialName] || placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
1410
|
+
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1395
1411
|
color: "#1a1a1a",
|
|
1396
1412
|
roughness: 0.1
|
|
1397
1413
|
}), []);
|
|
@@ -1433,13 +1449,6 @@ function DoorModels(_ref7) {
|
|
|
1433
1449
|
height: exteriorFanlightHeightValue,
|
|
1434
1450
|
depth: exteriorFanlightDepthValue
|
|
1435
1451
|
} = exteriorFanlight;
|
|
1436
|
-
const {
|
|
1437
|
-
x1: occulusX1,
|
|
1438
|
-
x2: occulusX2,
|
|
1439
|
-
y1: occulusY1,
|
|
1440
|
-
y2: occulusY2,
|
|
1441
|
-
depth: occulusInfillDepth
|
|
1442
|
-
} = occulus;
|
|
1443
1452
|
const {
|
|
1444
1453
|
width: architraveWidth,
|
|
1445
1454
|
depth: architraveDepth
|
|
@@ -1458,13 +1467,9 @@ function DoorModels(_ref7) {
|
|
|
1458
1467
|
const frameDepthM = frameDepth / 1000;
|
|
1459
1468
|
const topFrameWidthM = topThkValue / 1000;
|
|
1460
1469
|
const sidesFrameWidthM = sidesThkValue / 1000;
|
|
1470
|
+
const totalOpeningWidthM = isDoubleDoor ? doorWidthM * 2 : doorWidthM;
|
|
1461
1471
|
const exteriorFanlightHeightM = exteriorFanlight.visible ? exteriorFanlightHeightValue / 1000 : 0;
|
|
1462
1472
|
const exteriorFanlightDepthM = exteriorFanlightDepthValue / 1000;
|
|
1463
|
-
const occulusX1M = occulusX1 / 1000;
|
|
1464
|
-
const occulusX2M = occulusX2 / 1000;
|
|
1465
|
-
const occulusY1M = occulusY1 / 1000;
|
|
1466
|
-
const occulusY2M = occulusY2 / 1000;
|
|
1467
|
-
const occulusInfillDepthM = occulusInfillDepth / 1000;
|
|
1468
1473
|
const doorStopWidthM = doorStopWidth / 1000;
|
|
1469
1474
|
const doorStopDepthM = doorStopDepth / 1000;
|
|
1470
1475
|
|
|
@@ -1512,16 +1517,9 @@ function DoorModels(_ref7) {
|
|
|
1512
1517
|
}
|
|
1513
1518
|
}, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
|
|
1514
1519
|
const GlassPanelDepthM = glassDepth / 1000;
|
|
1515
|
-
const frontGlassOffsetZ = doorDepthM / 2 + GlassPanelDepthM / 2;
|
|
1516
|
-
const backGlassOffsetZ = -doorDepthM / 2 - GlassPanelDepthM / 2;
|
|
1517
1520
|
const exteriorFanlightZPosition = exteriorFanlightType === "ALSGFL" ? 0 // Center it
|
|
1518
1521
|
: isOpeningIn ? -frameDepthM / 2 + exteriorFanlightDepthM / 2 : frameDepthM / 2 - exteriorFanlightDepthM / 2;
|
|
1519
|
-
const occulusWidthM = doorWidthM - occulusX1M - occulusX2M;
|
|
1520
|
-
const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
|
|
1521
|
-
const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
|
|
1522
|
-
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
1523
1522
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
1524
|
-
const hingeSideX = doorPivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
1525
1523
|
const leftGlass_Z = -frameDepthM / 2 + GlassPanelDepthM / 2 - GlassPanelDepthM;
|
|
1526
1524
|
const rightGlass_Z = frameDepthM / 2 - GlassPanelDepthM / 2 + GlassPanelDepthM;
|
|
1527
1525
|
// --- PIVOT ---
|
|
@@ -1535,11 +1533,9 @@ function DoorModels(_ref7) {
|
|
|
1535
1533
|
}
|
|
1536
1534
|
return isOpeningIn ? -frameDepthM / 2 : frameDepthM / 2;
|
|
1537
1535
|
}, [frameType, isOpeningIn, doorCenterZ, doorDepthM, frameDepthM]);
|
|
1538
|
-
|
|
1536
|
+
React.useMemo(() => doorCenterZ - hingeZ, [doorCenterZ, hingeZ]);
|
|
1539
1537
|
const directionMultiplier = doorOpening === "in" ? 1 : -1;
|
|
1540
|
-
|
|
1541
|
-
rotation
|
|
1542
|
-
} = three.useSpring({
|
|
1538
|
+
three.useSpring({
|
|
1543
1539
|
rotation: isOpen ? [0, (doorPivot === "left" ? Math.PI / 2 : -Math.PI / 2) * directionMultiplier, 0] : [0, 0, 0],
|
|
1544
1540
|
config: {
|
|
1545
1541
|
mass: 1,
|
|
@@ -1547,15 +1543,13 @@ function DoorModels(_ref7) {
|
|
|
1547
1543
|
friction: 20
|
|
1548
1544
|
}
|
|
1549
1545
|
});
|
|
1550
|
-
const
|
|
1551
|
-
const totalFrameWidth = doorWidthM + sidesFrameWidthM * 2;
|
|
1546
|
+
const totalFrameWidth = totalOpeningWidthM + sidesFrameWidthM * 2;
|
|
1552
1547
|
const totalFrameHeightM = totalOpeningHeightM + topFrameWidthM;
|
|
1553
1548
|
|
|
1554
1549
|
// --- Centering Logic ---
|
|
1555
1550
|
const yCenteringOffset = -topFrameWidthM / 2;
|
|
1556
1551
|
const sideFrameCenterY = topFrameWidthM / 2;
|
|
1557
1552
|
const interiorFanlightYPosition = totalOpeningHeightM / 2 - interiorFanlightHeightM / 2;
|
|
1558
|
-
const doorYPosition = -totalOpeningHeightM / 2 + mainDoorHeightM / 2;
|
|
1559
1553
|
const topFrameCenterY = totalOpeningHeightM / 2 + topFrameWidthM / 2;
|
|
1560
1554
|
const topOfFrameY = topFrameCenterY + topFrameWidthM / 2;
|
|
1561
1555
|
const exteriorFanlightYPosition = topOfFrameY + exteriorFanlightHeightM / 2;
|
|
@@ -1563,59 +1557,28 @@ function DoorModels(_ref7) {
|
|
|
1563
1557
|
const backArchitraveZ = -frameDepthM / 2 - architraveDepthM / 2;
|
|
1564
1558
|
const sideArchitraveHeight = totalOpeningHeightM;
|
|
1565
1559
|
const sideArchitraveCenterY = 0;
|
|
1566
|
-
const leftArchitraveX = -
|
|
1567
|
-
const rightArchitraveX =
|
|
1560
|
+
const leftArchitraveX = -totalOpeningWidthM / 2 - architraveProfileM / 2;
|
|
1561
|
+
const rightArchitraveX = totalOpeningWidthM / 2 + architraveProfileM / 2;
|
|
1568
1562
|
const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
|
|
1569
|
-
const topArchitraveWidth =
|
|
1570
|
-
|
|
1571
|
-
// --- Handle placement ---
|
|
1572
|
-
// Handle local placement on the DOOR LEAF so it follows rotation
|
|
1573
|
-
const handleCenterYFromDoorBottom = 1.0; // 1000 mm from bottom by default
|
|
1574
|
-
const safeHandleY = Math.min(Math.max(handleCenterYFromDoorBottom, 0.25), mainDoorHeightM - 0.25);
|
|
1575
|
-
const handleHeightM = -mainDoorHeightM / 2 + safeHandleY; // convert to door local Y
|
|
1563
|
+
const topArchitraveWidth = totalOpeningWidthM + 2 * architraveProfileM;
|
|
1576
1564
|
|
|
1577
|
-
// Check if the door is a glass type to adjust handle positioning
|
|
1578
|
-
const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
|
|
1579
|
-
const nonHingeSideX = doorPivot === "left" ? doorWidthM / 2 : -doorWidthM / 2;
|
|
1580
|
-
let handleX;
|
|
1581
|
-
if (isSingleGlass) {
|
|
1582
|
-
// For the glass handle, position it right at the edge.
|
|
1583
|
-
// The MergedPlate in GlassHandle is 0.1m wide, so we offset by half its width (0.05m).
|
|
1584
|
-
const plateHalfWidth = 0.05;
|
|
1585
|
-
handleX = nonHingeSideX + (doorPivot === "left" ? -plateHalfWidth : plateHalfWidth);
|
|
1586
|
-
} else {
|
|
1587
|
-
// For standard handles, keep the original margin.
|
|
1588
|
-
const latchMarginM = 0.08; // 80 mm from latch edge
|
|
1589
|
-
handleX = nonHingeSideX + (doorPivot === "left" ? -latchMarginM : latchMarginM);
|
|
1590
|
-
}
|
|
1591
1565
|
// --- Primary Gasket Edge Position Calculations ---
|
|
1592
1566
|
const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1593
|
-
const leftGasketXPosition = -
|
|
1594
|
-
const rightGasketXPosition =
|
|
1567
|
+
const leftGasketXPosition = -totalOpeningWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
|
|
1568
|
+
const rightGasketXPosition = totalOpeningWidthM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1595
1569
|
|
|
1596
1570
|
// --- Second Gasket ---
|
|
1597
1571
|
|
|
1598
1572
|
const secondTopGasketYPosition = totalOpeningHeightM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1599
|
-
const secondLeftGasketXPosition = -
|
|
1600
|
-
const secondRightGasketXPosition =
|
|
1601
|
-
// --- HINGE CALCULATIONS ---
|
|
1602
|
-
const hingeTotalHeightM = 120 / 1000;
|
|
1603
|
-
const hingeRadiusM = 8 / 1000;
|
|
1604
|
-
const capHeightM = 4 / 1000;
|
|
1605
|
-
const separatorHeightM = 4 / 1000;
|
|
1606
|
-
const barrelPartHeight = (hingeTotalHeightM - capHeightM * 2 - separatorHeightM) / 2;
|
|
1573
|
+
const secondLeftGasketXPosition = -totalOpeningWidthM / 2 + secondDoorStopWidthM - gasketWidthM / 2;
|
|
1574
|
+
const secondRightGasketXPosition = totalOpeningWidthM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1607
1575
|
|
|
1608
1576
|
// --- HINGE VISIBILITY LOGIC ---
|
|
1609
1577
|
const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
|
|
1610
1578
|
const pivotNewPosition = (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1611
|
-
console.log("////////");
|
|
1612
|
-
console.log("initialDoorHeight.current", initialDoorHeight.current);
|
|
1613
|
-
console.log("doorHeight", doorHeight);
|
|
1614
|
-
console.log("pivotNewPosition", pivotNewPosition);
|
|
1615
|
-
console.log("////////");
|
|
1616
1579
|
|
|
1617
1580
|
// Calculate evenly spaced hinge positions
|
|
1618
|
-
|
|
1581
|
+
React.useMemo(() => {
|
|
1619
1582
|
const numHinges = 4;
|
|
1620
1583
|
const topMargin = 180 / 1000;
|
|
1621
1584
|
const bottomMargin = 180 / 1000;
|
|
@@ -1629,7 +1592,7 @@ function DoorModels(_ref7) {
|
|
|
1629
1592
|
}, [mainDoorHeightM]);
|
|
1630
1593
|
|
|
1631
1594
|
// Y positions for the new glass hinges
|
|
1632
|
-
|
|
1595
|
+
React.useMemo(() => {
|
|
1633
1596
|
const topMargin = 250 / 1000;
|
|
1634
1597
|
const secondTopMargin = 450 / 1000;
|
|
1635
1598
|
const bottomMargin = 250 / 1000;
|
|
@@ -1638,7 +1601,7 @@ function DoorModels(_ref7) {
|
|
|
1638
1601
|
const bottom = -mainDoorHeightM / 2 + bottomMargin;
|
|
1639
1602
|
return [top, secondTop, bottom];
|
|
1640
1603
|
}, [mainDoorHeightM]);
|
|
1641
|
-
|
|
1604
|
+
React.useMemo(() => {
|
|
1642
1605
|
if (isGlassDoor) return false;
|
|
1643
1606
|
if (!isFrameVisible) return false;
|
|
1644
1607
|
const invisibleFrameTypes = ["WDGF_WDG100", "WF_100", "WF_FLI"];
|
|
@@ -1647,6 +1610,24 @@ function DoorModels(_ref7) {
|
|
|
1647
1610
|
}
|
|
1648
1611
|
return true;
|
|
1649
1612
|
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
1613
|
+
const doorInstances = React.useMemo(() => {
|
|
1614
|
+
if (isDoubleDoor) {
|
|
1615
|
+
return [{
|
|
1616
|
+
key: "left",
|
|
1617
|
+
pivot: "left",
|
|
1618
|
+
x: -doorWidthM / 2
|
|
1619
|
+
}, {
|
|
1620
|
+
key: "right",
|
|
1621
|
+
pivot: "right",
|
|
1622
|
+
x: doorWidthM / 2
|
|
1623
|
+
}];
|
|
1624
|
+
}
|
|
1625
|
+
return [{
|
|
1626
|
+
key: "single",
|
|
1627
|
+
pivot: doorPivot,
|
|
1628
|
+
x: 0
|
|
1629
|
+
}];
|
|
1630
|
+
}, [isDoubleDoor, doorWidthM, doorPivot]);
|
|
1650
1631
|
if (is2D) {
|
|
1651
1632
|
return /*#__PURE__*/jsxRuntime.jsx("group", {
|
|
1652
1633
|
"position-y": yCenteringOffset + 0.1,
|
|
@@ -1728,20 +1709,20 @@ function DoorModels(_ref7) {
|
|
|
1728
1709
|
name: "frame-base",
|
|
1729
1710
|
material: frameMaterial,
|
|
1730
1711
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1731
|
-
args: [
|
|
1712
|
+
args: [totalOpeningWidthM, topFrameWidthM, frameDepthM]
|
|
1732
1713
|
})
|
|
1733
1714
|
}), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
1734
1715
|
name: "cut-exterior",
|
|
1735
1716
|
material: frameMaterial,
|
|
1736
1717
|
position: [0, notchposition, 0],
|
|
1737
1718
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1738
|
-
args: [
|
|
1719
|
+
args: [totalOpeningWidthM + 0.01, notchWidthM, notchDepthM]
|
|
1739
1720
|
})
|
|
1740
1721
|
})]
|
|
1741
1722
|
})
|
|
1742
1723
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1743
1724
|
castShadow: true,
|
|
1744
|
-
position: [-
|
|
1725
|
+
position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2, sideFrameCenterY, 0],
|
|
1745
1726
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
1746
1727
|
useGroups: true,
|
|
1747
1728
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
@@ -1761,7 +1742,7 @@ function DoorModels(_ref7) {
|
|
|
1761
1742
|
})
|
|
1762
1743
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1763
1744
|
castShadow: true,
|
|
1764
|
-
position: [
|
|
1745
|
+
position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2, sideFrameCenterY, 0],
|
|
1765
1746
|
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
1766
1747
|
useGroups: true,
|
|
1767
1748
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
@@ -1784,18 +1765,18 @@ function DoorModels(_ref7) {
|
|
|
1784
1765
|
position: [0, totalOpeningHeightM / 2 - doorStopWidthM / 2, doorStopPositionZ],
|
|
1785
1766
|
material: doorStopMaterial,
|
|
1786
1767
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1787
|
-
args: [
|
|
1768
|
+
args: [totalOpeningWidthM, doorStopWidthM, doorStopDepthM]
|
|
1788
1769
|
})
|
|
1789
1770
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1790
1771
|
castShadow: true,
|
|
1791
|
-
position: [-
|
|
1772
|
+
position: [-totalOpeningWidthM / 2 + doorStopWidthM / 2, 0, doorStopPositionZ],
|
|
1792
1773
|
material: doorStopMaterial,
|
|
1793
1774
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1794
1775
|
args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
|
|
1795
1776
|
})
|
|
1796
1777
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1797
1778
|
castShadow: true,
|
|
1798
|
-
position: [
|
|
1779
|
+
position: [totalOpeningWidthM / 2 - doorStopWidthM / 2, 0, doorStopPositionZ],
|
|
1799
1780
|
material: doorStopMaterial,
|
|
1800
1781
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1801
1782
|
args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
|
|
@@ -1806,7 +1787,7 @@ function DoorModels(_ref7) {
|
|
|
1806
1787
|
position: [0, topGasketYPosition, gasketZPosition],
|
|
1807
1788
|
material: gasketMaterial,
|
|
1808
1789
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1809
|
-
args: [
|
|
1790
|
+
args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
|
|
1810
1791
|
})
|
|
1811
1792
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1812
1793
|
castShadow: true,
|
|
@@ -1830,18 +1811,18 @@ function DoorModels(_ref7) {
|
|
|
1830
1811
|
position: [0, totalOpeningHeightM / 2 - secondDoorStopWidthM / 2, secondDoorStopPositionZ],
|
|
1831
1812
|
material: doorStopMaterial,
|
|
1832
1813
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1833
|
-
args: [
|
|
1814
|
+
args: [totalOpeningWidthM, secondDoorStopWidthM, secondDoorStopDepthM]
|
|
1834
1815
|
})
|
|
1835
1816
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1836
1817
|
castShadow: true,
|
|
1837
|
-
position: [-
|
|
1818
|
+
position: [-totalOpeningWidthM / 2 + secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
|
|
1838
1819
|
material: doorStopMaterial,
|
|
1839
1820
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1840
1821
|
args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
|
|
1841
1822
|
})
|
|
1842
1823
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1843
1824
|
castShadow: true,
|
|
1844
|
-
position: [
|
|
1825
|
+
position: [totalOpeningWidthM / 2 - secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
|
|
1845
1826
|
material: doorStopMaterial,
|
|
1846
1827
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1847
1828
|
args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
|
|
@@ -1853,7 +1834,7 @@ function DoorModels(_ref7) {
|
|
|
1853
1834
|
position: [0, secondTopGasketYPosition - 0.005, secondGasketZPosition],
|
|
1854
1835
|
material: gasketMaterial,
|
|
1855
1836
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1856
|
-
args: [
|
|
1837
|
+
args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
|
|
1857
1838
|
})
|
|
1858
1839
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1859
1840
|
castShadow: true,
|
|
@@ -1877,25 +1858,25 @@ function DoorModels(_ref7) {
|
|
|
1877
1858
|
position: [0, topFrameCenterY - secondDoorStopWidthM / 2, leftGlass_Z],
|
|
1878
1859
|
material: glassInfillMaterial,
|
|
1879
1860
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1880
|
-
args: [
|
|
1861
|
+
args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM + secondDoorStopWidthM, GlassPanelDepthM]
|
|
1881
1862
|
})
|
|
1882
1863
|
}), frameType !== "WDGF_WDG100" && frameType !== "WF_100" && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1883
1864
|
castShadow: true,
|
|
1884
1865
|
position: [0, topFrameCenterY, leftGlass_Z],
|
|
1885
1866
|
material: glassInfillMaterial,
|
|
1886
1867
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1887
|
-
args: [
|
|
1868
|
+
args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM, GlassPanelDepthM]
|
|
1888
1869
|
})
|
|
1889
1870
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1890
1871
|
castShadow: true,
|
|
1891
|
-
position: [-
|
|
1872
|
+
position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2 + secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
|
|
1892
1873
|
material: glassInfillMaterial,
|
|
1893
1874
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1894
1875
|
args: [sidesFrameWidthM + secondDoorStopWidthM, totalFrameHeightM, GlassPanelDepthM]
|
|
1895
1876
|
})
|
|
1896
1877
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1897
1878
|
castShadow: true,
|
|
1898
|
-
position: [
|
|
1879
|
+
position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2 - secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
|
|
1899
1880
|
material: glassInfillMaterial,
|
|
1900
1881
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1901
1882
|
args: [sidesFrameWidthM + secondDoorStopWidthM, totalFrameHeightM, GlassPanelDepthM]
|
|
@@ -1907,18 +1888,18 @@ function DoorModels(_ref7) {
|
|
|
1907
1888
|
position: [0, topFrameCenterY, rightGlass_Z],
|
|
1908
1889
|
material: glassInfillMaterial,
|
|
1909
1890
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1910
|
-
args: [
|
|
1891
|
+
args: [totalOpeningWidthM, topFrameWidthM, GlassPanelDepthM]
|
|
1911
1892
|
})
|
|
1912
1893
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1913
1894
|
castShadow: true,
|
|
1914
|
-
position: [-
|
|
1895
|
+
position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
|
|
1915
1896
|
material: glassInfillMaterial,
|
|
1916
1897
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1917
1898
|
args: [sidesFrameWidthM, totalFrameHeightM, GlassPanelDepthM]
|
|
1918
1899
|
})
|
|
1919
1900
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1920
1901
|
castShadow: true,
|
|
1921
|
-
position: [
|
|
1902
|
+
position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
|
|
1922
1903
|
material: glassInfillMaterial,
|
|
1923
1904
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1924
1905
|
args: [sidesFrameWidthM, totalFrameHeightM, GlassPanelDepthM]
|
|
@@ -1932,144 +1913,447 @@ function DoorModels(_ref7) {
|
|
|
1932
1913
|
castShadow: true,
|
|
1933
1914
|
material: interiorFanlightMaterial,
|
|
1934
1915
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1935
|
-
args: [
|
|
1916
|
+
args: [totalOpeningWidthM, interiorFanlightHeightM, doorDepthM]
|
|
1917
|
+
})
|
|
1918
|
+
}), doorInstances.map(instance => /*#__PURE__*/jsxRuntime.jsx(DoorLeaf, {
|
|
1919
|
+
pivot: instance.pivot,
|
|
1920
|
+
xOffset: instance.x
|
|
1921
|
+
}, instance.key))]
|
|
1922
|
+
})
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function DoorLeaf(_ref8) {
|
|
1926
|
+
let {
|
|
1927
|
+
pivot,
|
|
1928
|
+
xOffset
|
|
1929
|
+
} = _ref8;
|
|
1930
|
+
const {
|
|
1931
|
+
is2D,
|
|
1932
|
+
totalWidth,
|
|
1933
|
+
totalHeight,
|
|
1934
|
+
isPlaneVisible,
|
|
1935
|
+
isFrameVisible,
|
|
1936
|
+
door,
|
|
1937
|
+
doorFrame,
|
|
1938
|
+
interiorFanlight,
|
|
1939
|
+
exteriorFanlight,
|
|
1940
|
+
occulus,
|
|
1941
|
+
glass,
|
|
1942
|
+
frontCoverPanel,
|
|
1943
|
+
backCoverPanel,
|
|
1944
|
+
frontDoorPlane,
|
|
1945
|
+
backDoorPlane,
|
|
1946
|
+
frameType,
|
|
1947
|
+
bodyType,
|
|
1948
|
+
exteriorFanlightType,
|
|
1949
|
+
testDoorMaterial,
|
|
1950
|
+
testFrameMaterial,
|
|
1951
|
+
testGasketMaterial,
|
|
1952
|
+
testInteriorFanlightMaterial,
|
|
1953
|
+
testExteriorFanlightMaterial,
|
|
1954
|
+
testOcculusInfillMaterial,
|
|
1955
|
+
testGlassInfillMaterial,
|
|
1956
|
+
testDoorStopMaterial,
|
|
1957
|
+
testHingeMaterial,
|
|
1958
|
+
glassVisible,
|
|
1959
|
+
testFrontCoverPanelMaterial,
|
|
1960
|
+
testBackCoverPanelMaterial,
|
|
1961
|
+
testFrontDoorPlaneMaterial,
|
|
1962
|
+
testBackDoorPlaneMaterial,
|
|
1963
|
+
glassDepth,
|
|
1964
|
+
cpid,
|
|
1965
|
+
handleParseCpid
|
|
1966
|
+
} = useConfigurator();
|
|
1967
|
+
|
|
1968
|
+
// here i get material names from context
|
|
1969
|
+
const {
|
|
1970
|
+
doorMaterial: doorMaterialName
|
|
1971
|
+
} = door;
|
|
1972
|
+
const {
|
|
1973
|
+
frameMaterial: frameMaterialName,
|
|
1974
|
+
gasketMaterial: gasketMaterialName,
|
|
1975
|
+
doorStopMaterial: doorStopMaterialName,
|
|
1976
|
+
hingeMaterial: hingeMaterialName
|
|
1977
|
+
} = doorFrame;
|
|
1978
|
+
const {
|
|
1979
|
+
material: interiorFanlightMaterialName
|
|
1980
|
+
} = interiorFanlight;
|
|
1981
|
+
const {
|
|
1982
|
+
material: exteriorFanlightMaterialName
|
|
1983
|
+
} = exteriorFanlight;
|
|
1984
|
+
const {
|
|
1985
|
+
material: occulusInfillMaterialName
|
|
1986
|
+
} = occulus;
|
|
1987
|
+
const {
|
|
1988
|
+
material: glassInfillMaterialName
|
|
1989
|
+
} = glass;
|
|
1990
|
+
const {
|
|
1991
|
+
material: frontCoverPanelMaterialName
|
|
1992
|
+
} = frontCoverPanel;
|
|
1993
|
+
const {
|
|
1994
|
+
material: backCoverPanelMaterialName
|
|
1995
|
+
} = backCoverPanel;
|
|
1996
|
+
const {
|
|
1997
|
+
material: frontDoorPlaneMaterialName
|
|
1998
|
+
} = frontDoorPlane;
|
|
1999
|
+
const {
|
|
2000
|
+
material: backDoorPlaneMaterialName
|
|
2001
|
+
} = backDoorPlane;
|
|
2002
|
+
|
|
2003
|
+
// --- Material Logic ---
|
|
2004
|
+
const doorMaterial = React.useMemo(() => availableMaterials[testDoorMaterial] || availableMaterials[doorMaterialName] || placeholderMaterial, [testDoorMaterial, doorMaterialName]);
|
|
2005
|
+
const frameMaterial = React.useMemo(() => availableMaterials[testFrameMaterial] || availableMaterials[frameMaterialName] || placeholderMaterialforFrames, [testFrameMaterial, frameMaterialName]);
|
|
2006
|
+
const gasketMaterial = React.useMemo(() => availableMaterials[testGasketMaterial] || availableMaterials[gasketMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
2007
|
+
color: "#111111"
|
|
2008
|
+
}), [testGasketMaterial, gasketMaterialName]);
|
|
2009
|
+
React.useMemo(() => {
|
|
2010
|
+
return availableMaterials[testDoorStopMaterial] || availableMaterials[doorStopMaterialName || ""] || frameMaterial;
|
|
2011
|
+
}, [testDoorStopMaterial, doorStopMaterialName, frameType, frameMaterial]);
|
|
2012
|
+
React.useMemo(() => availableMaterials[testInteriorFanlightMaterial] || availableMaterials[interiorFanlightMaterialName] || placeholderMaterial, [testInteriorFanlightMaterial, interiorFanlightMaterialName]);
|
|
2013
|
+
React.useMemo(() => availableMaterials[testExteriorFanlightMaterial] || availableMaterials[exteriorFanlightMaterialName] || placeholderMaterial, [testExteriorFanlightMaterial, exteriorFanlightMaterialName]);
|
|
2014
|
+
const occulusInfillMaterial = React.useMemo(() => availableMaterials[testOcculusInfillMaterial] || availableMaterials[occulusInfillMaterialName] || placeholderMaterial, [testOcculusInfillMaterial, occulusInfillMaterialName]);
|
|
2015
|
+
const glassInfillMaterial = React.useMemo(() => availableMaterials[testGlassInfillMaterial] || availableMaterials[glassInfillMaterialName] || placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
2016
|
+
const hingeBodyMaterial = React.useMemo(() => availableMaterials[testHingeMaterial] || availableMaterials[hingeMaterialName] || new THREE__namespace.MeshStandardMaterial({
|
|
2017
|
+
color: "#d4d4d4",
|
|
2018
|
+
metalness: 1.0,
|
|
2019
|
+
roughness: 0.4
|
|
2020
|
+
}), [testHingeMaterial, hingeMaterialName]);
|
|
2021
|
+
React.useMemo(() => availableMaterials[testFrontCoverPanelMaterial] || availableMaterials[frontCoverPanelMaterialName] || placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
2022
|
+
React.useMemo(() => availableMaterials[testBackCoverPanelMaterial] || availableMaterials[backCoverPanelMaterialName] || placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
2023
|
+
const frontDoorPlaneMaterial = React.useMemo(() => availableMaterials[testFrontDoorPlaneMaterial] || availableMaterials[frontDoorPlaneMaterialName] || placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
2024
|
+
const backDoorPlaneMaterial = React.useMemo(() => availableMaterials[testBackDoorPlaneMaterial] || availableMaterials[backDoorPlaneMaterialName] || placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
2025
|
+
const hingeAccentMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2026
|
+
color: "#1a1a1a",
|
|
2027
|
+
roughness: 0.1
|
|
2028
|
+
}), []);
|
|
2029
|
+
|
|
2030
|
+
// --- Dimension calculations ---
|
|
2031
|
+
const {
|
|
2032
|
+
doorWidth,
|
|
2033
|
+
doorHeight,
|
|
2034
|
+
theDoorDepth,
|
|
2035
|
+
doorPivot,
|
|
2036
|
+
doorOpening
|
|
2037
|
+
} = door;
|
|
2038
|
+
const {
|
|
2039
|
+
frameDepth,
|
|
2040
|
+
topThk,
|
|
2041
|
+
sidesThk,
|
|
2042
|
+
doorStopWidth,
|
|
2043
|
+
doorStopDepth,
|
|
2044
|
+
doorStopOffset,
|
|
2045
|
+
notchWidth,
|
|
2046
|
+
notchDepth,
|
|
2047
|
+
notchposition,
|
|
2048
|
+
gasketWidth,
|
|
2049
|
+
gasketDepth,
|
|
2050
|
+
secondDoorStopWidth,
|
|
2051
|
+
secondDoorStopDepth,
|
|
2052
|
+
secondDoorStopOffset
|
|
2053
|
+
} = doorFrame;
|
|
2054
|
+
React.useRef(doorHeight);
|
|
2055
|
+
|
|
2056
|
+
// useEffect(() => {
|
|
2057
|
+
// initialDoorHeight.current = doorHeight;
|
|
2058
|
+
// }, [cpid]);
|
|
2059
|
+
|
|
2060
|
+
const {
|
|
2061
|
+
height: interiorFanlightHeightValue
|
|
2062
|
+
} = interiorFanlight;
|
|
2063
|
+
const {
|
|
2064
|
+
height: exteriorFanlightHeightValue,
|
|
2065
|
+
depth: exteriorFanlightDepthValue
|
|
2066
|
+
} = exteriorFanlight;
|
|
2067
|
+
const {
|
|
2068
|
+
x1: occulusX1,
|
|
2069
|
+
x2: occulusX2,
|
|
2070
|
+
y1: occulusY1,
|
|
2071
|
+
y2: occulusY2,
|
|
2072
|
+
depth: occulusInfillDepth
|
|
2073
|
+
} = occulus;
|
|
2074
|
+
const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlightHeightValue : 0;
|
|
2075
|
+
const mainDoorHeight = doorHeight - interiorFanlightHeight;
|
|
2076
|
+
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
2077
|
+
|
|
2078
|
+
// Convert dimensions from mm to meters
|
|
2079
|
+
const doorWidthM = doorWidth / 1000;
|
|
2080
|
+
const mainDoorHeightM = mainDoorHeight / 1000;
|
|
2081
|
+
const totalOpeningHeightM = doorHeight / 1000;
|
|
2082
|
+
const doorDepthM = theDoorDepth / 1000;
|
|
2083
|
+
const frameDepthM = frameDepth / 1000;
|
|
2084
|
+
const sidesFrameWidthM = sidesThkValue / 1000;
|
|
2085
|
+
exteriorFanlight.visible ? exteriorFanlightHeightValue / 1000 : 0;
|
|
2086
|
+
const occulusX1M = occulusX1 / 1000;
|
|
2087
|
+
const occulusX2M = occulusX2 / 1000;
|
|
2088
|
+
const occulusY1M = occulusY1 / 1000;
|
|
2089
|
+
const occulusY2M = occulusY2 / 1000;
|
|
2090
|
+
const occulusInfillDepthM = occulusInfillDepth / 1000;
|
|
2091
|
+
const doorStopWidthM = doorStopWidth / 1000;
|
|
2092
|
+
const doorStopDepthM = doorStopDepth / 1000;
|
|
2093
|
+
const gasketDepthM = gasketDepth / 1000;
|
|
2094
|
+
const doorStopOffsetValue = parseInt(doorStopOffset);
|
|
2095
|
+
const doorStopOffsetFromEdgeM = doorStopOffsetValue / 1000;
|
|
2096
|
+
const isOpeningIn = doorOpening === "in";
|
|
2097
|
+
const doorStopPositionZ = React.useMemo(() => isOpeningIn ? frameDepthM / 2 - doorStopOffsetFromEdgeM - doorStopDepthM / 2 : -frameDepthM / 2 + doorStopOffsetFromEdgeM + doorStopDepthM / 2, [isOpeningIn, frameDepthM, doorStopOffsetFromEdgeM, doorStopDepthM]);
|
|
2098
|
+
const gasketZPosition = React.useMemo(() => isOpeningIn ? doorStopPositionZ - doorStopDepthM / 2 - gasketDepthM / 2 : doorStopPositionZ + doorStopDepthM / 2 + gasketDepthM / 2, [isOpeningIn, doorStopPositionZ, doorStopDepthM, gasketDepthM]);
|
|
2099
|
+
const secondDoorStopWidthM = secondDoorStopWidth / 1000;
|
|
2100
|
+
const secondDoorStopDepthM = secondDoorStopDepth / 1000;
|
|
2101
|
+
const secondDoorStopPositionZ = isOpeningIn ? frameDepthM / 2 - secondDoorStopDepthM / 2 : -frameDepthM / 2 + secondDoorStopDepthM / 2;
|
|
2102
|
+
const doorCenterZ = React.useMemo(() => {
|
|
2103
|
+
if (frameType === "WF_FLI") {
|
|
2104
|
+
if (isOpeningIn) {
|
|
2105
|
+
return frameDepthM / 2 - doorDepthM / 2;
|
|
2106
|
+
} else {
|
|
2107
|
+
return -frameDepthM / 2 + doorDepthM / 2;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
if (frameType === "WDGF_WDG100" || frameType === "WF_100") {
|
|
2111
|
+
return 0;
|
|
2112
|
+
} else {
|
|
2113
|
+
if (isOpeningIn) {
|
|
2114
|
+
const gasketBackFaceZ = gasketZPosition - gasketDepthM / 2;
|
|
2115
|
+
return gasketBackFaceZ - doorDepthM / 2;
|
|
2116
|
+
} else {
|
|
2117
|
+
const gasketFrontFaceZ = gasketZPosition + gasketDepthM / 2;
|
|
2118
|
+
return gasketFrontFaceZ + doorDepthM / 2;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
|
|
2122
|
+
const GlassPanelDepthM = glassDepth / 1000;
|
|
2123
|
+
const frontGlassOffsetZ = doorDepthM / 2 + GlassPanelDepthM / 2;
|
|
2124
|
+
const backGlassOffsetZ = -doorDepthM / 2 - GlassPanelDepthM / 2;
|
|
2125
|
+
const occulusWidthM = doorWidthM - occulusX1M - occulusX2M;
|
|
2126
|
+
const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
|
|
2127
|
+
const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
|
|
2128
|
+
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
2129
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
2130
|
+
const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
2131
|
+
// --- PIVOT ---
|
|
2132
|
+
const hingeZ = React.useMemo(() => {
|
|
2133
|
+
if (frameType === "WF_FLI") {
|
|
2134
|
+
if (isOpeningIn) {
|
|
2135
|
+
return doorCenterZ - doorDepthM / 2;
|
|
2136
|
+
} else {
|
|
2137
|
+
return doorCenterZ + doorDepthM / 2;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
return isOpeningIn ? -frameDepthM / 2 : frameDepthM / 2;
|
|
2141
|
+
}, [frameType, isOpeningIn, doorCenterZ, doorDepthM, frameDepthM]);
|
|
2142
|
+
const doorOffsetZ = React.useMemo(() => doorCenterZ - hingeZ, [doorCenterZ, hingeZ]);
|
|
2143
|
+
const directionMultiplier = doorOpening === "in" ? 1 : -1;
|
|
2144
|
+
const {
|
|
2145
|
+
rotation
|
|
2146
|
+
} = three.useSpring({
|
|
2147
|
+
rotation: isOpen ? [0, (pivot === "left" ? Math.PI / 2 : -Math.PI / 2) * directionMultiplier, 0] : [0, 0, 0],
|
|
2148
|
+
config: {
|
|
2149
|
+
mass: 1,
|
|
2150
|
+
tension: 100,
|
|
2151
|
+
friction: 20
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
const handleClick = () => setIsOpen(!isOpen);
|
|
2155
|
+
const doorYPosition = -totalOpeningHeightM / 2 + mainDoorHeightM / 2;
|
|
2156
|
+
const handleCenterYFromDoorBottom = 1.0;
|
|
2157
|
+
const safeHandleY = Math.min(Math.max(handleCenterYFromDoorBottom, 0.25), mainDoorHeightM - 0.25);
|
|
2158
|
+
const handleHeightM = -mainDoorHeightM / 2 + safeHandleY;
|
|
2159
|
+
const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
|
|
2160
|
+
const nonHingeSideX = pivot === "left" ? doorWidthM / 2 : -doorWidthM / 2;
|
|
2161
|
+
let handleX;
|
|
2162
|
+
if (isSingleGlass) {
|
|
2163
|
+
const plateHalfWidth = 0.05;
|
|
2164
|
+
handleX = nonHingeSideX + (pivot === "left" ? -plateHalfWidth : plateHalfWidth);
|
|
2165
|
+
} else {
|
|
2166
|
+
const latchMarginM = 0.08;
|
|
2167
|
+
handleX = nonHingeSideX + (pivot === "left" ? -latchMarginM : latchMarginM);
|
|
2168
|
+
}
|
|
2169
|
+
const hingeTotalHeightM = 120 / 1000;
|
|
2170
|
+
const hingeRadiusM = 8 / 1000;
|
|
2171
|
+
const capHeightM = 4 / 1000;
|
|
2172
|
+
const separatorHeightM = 4 / 1000;
|
|
2173
|
+
const barrelPartHeight = (hingeTotalHeightM - capHeightM * 2 - separatorHeightM) / 2;
|
|
2174
|
+
const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
|
|
2175
|
+
const standardHingeYPositions = React.useMemo(() => {
|
|
2176
|
+
const numHinges = 4;
|
|
2177
|
+
const topMargin = 180 / 1000;
|
|
2178
|
+
const bottomMargin = 180 / 1000;
|
|
2179
|
+
const availableHeight = mainDoorHeightM - topMargin - bottomMargin;
|
|
2180
|
+
const spacing = availableHeight / (numHinges - 1);
|
|
2181
|
+
const positions = [];
|
|
2182
|
+
for (let i = 0; i < numHinges; i++) {
|
|
2183
|
+
positions.push(mainDoorHeightM / 2 - topMargin - i * spacing);
|
|
2184
|
+
}
|
|
2185
|
+
return positions;
|
|
2186
|
+
}, [mainDoorHeightM]);
|
|
2187
|
+
const glassHingeYPositions = React.useMemo(() => {
|
|
2188
|
+
const topMargin = 250 / 1000;
|
|
2189
|
+
const secondTopMargin = 450 / 1000;
|
|
2190
|
+
const bottomMargin = 250 / 1000;
|
|
2191
|
+
const top = mainDoorHeightM / 2 - topMargin;
|
|
2192
|
+
const secondTop = mainDoorHeightM / 2 - secondTopMargin;
|
|
2193
|
+
const bottom = -mainDoorHeightM / 2 + bottomMargin;
|
|
2194
|
+
return [top, secondTop, bottom];
|
|
2195
|
+
}, [mainDoorHeightM]);
|
|
2196
|
+
const isStandardHingeVisible = React.useMemo(() => {
|
|
2197
|
+
if (isGlassDoor) return false;
|
|
2198
|
+
if (!isFrameVisible) return false;
|
|
2199
|
+
const invisibleFrameTypes = ["WDGF_WDG100", "WF_100", "WF_FLI"];
|
|
2200
|
+
if (invisibleFrameTypes.includes(frameType)) {
|
|
2201
|
+
return false;
|
|
2202
|
+
}
|
|
2203
|
+
return true;
|
|
2204
|
+
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
2205
|
+
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2206
|
+
"position-x": xOffset,
|
|
2207
|
+
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2208
|
+
position: [hingeSideX, doorYPosition + y, hingeZ],
|
|
2209
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2210
|
+
material: hingeBodyMaterial,
|
|
2211
|
+
position: [0, separatorHeightM / 2 + barrelPartHeight / 2, 0],
|
|
2212
|
+
castShadow: true,
|
|
2213
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
2214
|
+
args: [hingeRadiusM, hingeRadiusM, barrelPartHeight, 32]
|
|
2215
|
+
})
|
|
2216
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2217
|
+
material: hingeAccentMaterial,
|
|
2218
|
+
position: [0, separatorHeightM / 2 + barrelPartHeight + capHeightM / 2, 0],
|
|
2219
|
+
castShadow: true,
|
|
2220
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
2221
|
+
args: [hingeRadiusM, hingeRadiusM, capHeightM, 32]
|
|
1936
2222
|
})
|
|
1937
|
-
})
|
|
1938
|
-
|
|
2223
|
+
})]
|
|
2224
|
+
}, "frame-hinge-".concat(index))), /*#__PURE__*/jsxRuntime.jsxs(three.a.group, {
|
|
2225
|
+
position: [hingeSideX, doorYPosition, hingeZ],
|
|
2226
|
+
rotation: rotation.to((x, y, z) => [x, y, z]),
|
|
2227
|
+
onClick: handleClick,
|
|
2228
|
+
onPointerOver: () => document.body.style.cursor = "pointer",
|
|
2229
|
+
onPointerOut: () => document.body.style.cursor = "auto",
|
|
2230
|
+
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2231
|
+
position: [0, y, 0],
|
|
1939
2232
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1940
2233
|
material: hingeBodyMaterial,
|
|
1941
|
-
position: [0, separatorHeightM / 2
|
|
2234
|
+
position: [0, -separatorHeightM / 2 - barrelPartHeight / 2, 0],
|
|
1942
2235
|
castShadow: true,
|
|
1943
2236
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1944
2237
|
args: [hingeRadiusM, hingeRadiusM, barrelPartHeight, 32]
|
|
1945
2238
|
})
|
|
1946
2239
|
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1947
2240
|
material: hingeAccentMaterial,
|
|
1948
|
-
position: [0, separatorHeightM / 2
|
|
2241
|
+
position: [0, -separatorHeightM / 2 - barrelPartHeight - capHeightM / 2, 0],
|
|
1949
2242
|
castShadow: true,
|
|
1950
2243
|
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
1951
2244
|
args: [hingeRadiusM, hingeRadiusM, capHeightM, 32]
|
|
1952
2245
|
})
|
|
2246
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2247
|
+
material: hingeAccentMaterial,
|
|
2248
|
+
position: [0, 0, 0],
|
|
2249
|
+
castShadow: true,
|
|
2250
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
2251
|
+
args: [hingeRadiusM, hingeRadiusM, separatorHeightM, 32]
|
|
2252
|
+
})
|
|
1953
2253
|
})]
|
|
1954
|
-
}, "
|
|
1955
|
-
position: [
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1998
|
-
|
|
1999
|
-
|
|
2254
|
+
}, "door-hinge-".concat(index))), isGlassDoor && isFrameVisible && glassHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsx(GlassHinge, {
|
|
2255
|
+
position: [0, y, doorOffsetZ],
|
|
2256
|
+
pivot: pivot,
|
|
2257
|
+
frameSideWidth: sidesFrameWidthM,
|
|
2258
|
+
doorDepthM: doorDepthM,
|
|
2259
|
+
material: hingeBodyMaterial,
|
|
2260
|
+
gasketMaterial: gasketMaterial
|
|
2261
|
+
}, "glass-hinge-".concat(index))), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2262
|
+
position: [-hingeSideX, 0, doorOffsetZ],
|
|
2263
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2264
|
+
castShadow: true,
|
|
2265
|
+
receiveShadow: true,
|
|
2266
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
|
|
2267
|
+
useGroups: true,
|
|
2268
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
|
|
2269
|
+
name: "door-base",
|
|
2270
|
+
material: doorMaterial,
|
|
2271
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2272
|
+
args: [doorWidthM, mainDoorHeightM, doorDepthM]
|
|
2273
|
+
})
|
|
2274
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
2275
|
+
visible: frameType === "WDGF_WDG100" || frameType === "WF_100" || frameType === "WF_FLI",
|
|
2276
|
+
width: doorWidthM,
|
|
2277
|
+
height: totalOpeningHeightM,
|
|
2278
|
+
stopWidth: doorStopWidthM,
|
|
2279
|
+
stopDepth: doorStopDepthM,
|
|
2280
|
+
stopPositionZ: doorStopPositionZ,
|
|
2281
|
+
centerZ: doorCenterZ,
|
|
2282
|
+
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2283
|
+
material: doorMaterial,
|
|
2284
|
+
setName: "1"
|
|
2285
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
2286
|
+
visible: frameType === "WDGF_WDG100" || frameType === "WF_100" || frameType === "WF_FLI",
|
|
2287
|
+
width: doorWidthM,
|
|
2288
|
+
height: totalOpeningHeightM,
|
|
2289
|
+
stopWidth: secondDoorStopWidthM,
|
|
2290
|
+
stopDepth: secondDoorStopDepthM,
|
|
2291
|
+
stopPositionZ: secondDoorStopPositionZ,
|
|
2292
|
+
centerZ: doorCenterZ,
|
|
2293
|
+
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2294
|
+
material: doorMaterial,
|
|
2295
|
+
setName: "2"
|
|
2296
|
+
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2297
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2298
|
+
position: [0, 0, frontGlassOffsetZ],
|
|
2299
|
+
castShadow: true,
|
|
2300
|
+
material: glassInfillMaterial,
|
|
2000
2301
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2001
|
-
args: [doorWidthM, mainDoorHeightM,
|
|
2302
|
+
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2002
2303
|
})
|
|
2003
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
stopWidth: doorStopWidthM,
|
|
2008
|
-
stopDepth: doorStopDepthM,
|
|
2009
|
-
stopPositionZ: doorStopPositionZ,
|
|
2010
|
-
centerZ: doorCenterZ,
|
|
2011
|
-
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2012
|
-
material: doorMaterial,
|
|
2013
|
-
setName: "1"
|
|
2014
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
2015
|
-
visible: frameType === "WDGF_WDG100" || frameType === "WF_100" || frameType === "WF_FLI",
|
|
2016
|
-
width: doorWidthM,
|
|
2017
|
-
height: totalOpeningHeightM,
|
|
2018
|
-
stopWidth: secondDoorStopWidthM,
|
|
2019
|
-
stopDepth: secondDoorStopDepthM,
|
|
2020
|
-
stopPositionZ: secondDoorStopPositionZ,
|
|
2021
|
-
centerZ: doorCenterZ,
|
|
2022
|
-
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2023
|
-
material: doorMaterial,
|
|
2024
|
-
setName: "2"
|
|
2025
|
-
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2026
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2027
|
-
position: [0, 0, frontGlassOffsetZ],
|
|
2028
|
-
castShadow: true,
|
|
2029
|
-
material: glassInfillMaterial,
|
|
2030
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2031
|
-
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2032
|
-
})
|
|
2033
|
-
}), frameType !== "WDGF_WDG100" && frameType !== "WF_100" && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2034
|
-
position: [0, 0, backGlassOffsetZ],
|
|
2035
|
-
castShadow: true,
|
|
2036
|
-
material: glassInfillMaterial,
|
|
2037
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2038
|
-
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2039
|
-
})
|
|
2040
|
-
}), (frameType === "WDGF_WDG100" || frameType === "WF_100") && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2041
|
-
position: [0, -secondDoorStopWidthM / 2, backGlassOffsetZ],
|
|
2042
|
-
castShadow: true,
|
|
2043
|
-
material: glassInfillMaterial,
|
|
2044
|
-
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2045
|
-
args: [doorWidthM - 2 * secondDoorStopWidthM, mainDoorHeightM - secondDoorStopWidthM, GlassPanelDepthM]
|
|
2046
|
-
})
|
|
2047
|
-
})]
|
|
2048
|
-
}), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
2049
|
-
material: placeholderMaterial,
|
|
2050
|
-
position: [occulusPositionXM, occulusPositionYM, 0],
|
|
2304
|
+
}), frameType !== "WDGF_WDG100" && frameType !== "WF_100" && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2305
|
+
position: [0, 0, backGlassOffsetZ],
|
|
2306
|
+
castShadow: true,
|
|
2307
|
+
material: glassInfillMaterial,
|
|
2051
2308
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2052
|
-
args: [
|
|
2309
|
+
args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
|
|
2310
|
+
})
|
|
2311
|
+
}), (frameType === "WDGF_WDG100" || frameType === "WF_100") && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2312
|
+
position: [0, -secondDoorStopWidthM / 2, backGlassOffsetZ],
|
|
2313
|
+
castShadow: true,
|
|
2314
|
+
material: glassInfillMaterial,
|
|
2315
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2316
|
+
args: [doorWidthM - 2 * secondDoorStopWidthM, mainDoorHeightM - secondDoorStopWidthM, GlassPanelDepthM]
|
|
2053
2317
|
})
|
|
2054
2318
|
})]
|
|
2055
|
-
})
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
})
|
|
2319
|
+
}), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
2320
|
+
material: placeholderMaterial,
|
|
2321
|
+
position: [occulusPositionXM, occulusPositionYM, 0],
|
|
2322
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2323
|
+
args: [occulusWidthM, occulusHeightM, doorDepthM + 0.01]
|
|
2324
|
+
})
|
|
2325
|
+
})]
|
|
2326
|
+
})
|
|
2327
|
+
}), frontDoorPlane.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2328
|
+
position: [0, 0, doorDepthM / 2 + 0.0005],
|
|
2329
|
+
material: frontDoorPlaneMaterial,
|
|
2330
|
+
castShadow: true,
|
|
2331
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2332
|
+
args: [doorWidthM, mainDoorHeightM, 0.001]
|
|
2333
|
+
})
|
|
2334
|
+
}), backDoorPlane.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2335
|
+
position: [0, 0, -doorDepthM / 2 - 0.0005],
|
|
2336
|
+
material: backDoorPlaneMaterial,
|
|
2337
|
+
castShadow: true,
|
|
2338
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2339
|
+
args: [doorWidthM, mainDoorHeightM, 0.0001]
|
|
2340
|
+
})
|
|
2341
|
+
}), occulus.visible && occulus.infillVisible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
2342
|
+
position: [occulusPositionXM, occulusPositionYM, 0],
|
|
2343
|
+
castShadow: true,
|
|
2344
|
+
material: occulusInfillMaterial,
|
|
2345
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
2346
|
+
args: [occulusWidthM, occulusHeightM, occulusInfillDepthM]
|
|
2347
|
+
})
|
|
2348
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DoorHandle, {
|
|
2349
|
+
bodyType: bodyType,
|
|
2350
|
+
handleX: handleX,
|
|
2351
|
+
handleHeightM: handleHeightM,
|
|
2352
|
+
doorDepthM: doorDepthM,
|
|
2353
|
+
doorPivot: pivot
|
|
2070
2354
|
})]
|
|
2071
2355
|
})]
|
|
2072
|
-
})
|
|
2356
|
+
})]
|
|
2073
2357
|
});
|
|
2074
2358
|
}
|
|
2075
2359
|
|