door_models 5.2.4 → 5.2.6
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 +84 -327
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +84 -327
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs.js
CHANGED
|
@@ -190,30 +190,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
190
190
|
material: "infill_material",
|
|
191
191
|
depth: 20
|
|
192
192
|
});
|
|
193
|
-
const defaultOptions = ["D_PRF_COLOR", "D_FR_SRF_DECOR", "D_FR_SRF_DECOR_S2"];
|
|
194
|
-
function getFirstValidValue(values, isValid) {
|
|
195
|
-
for (const val of values) {
|
|
196
|
-
if (isValid(val)) return val;
|
|
197
|
-
}
|
|
198
|
-
return "";
|
|
199
|
-
}
|
|
200
|
-
const hasValue = val => val !== null && val !== undefined && val !== "";
|
|
201
193
|
const [frameType, setFrameType] = React.useState("AF20_40");
|
|
202
194
|
const [bodyType, setBodyType] = React.useState("40");
|
|
203
195
|
const [exteriorFanlightType, setExteriorFanlightType] = React.useState("WPFL");
|
|
204
|
-
const [testDoorMaterial, setTestDoorMaterial] = React.useState("");
|
|
205
|
-
const [testFrameMaterial, setTestFrameMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
206
|
-
const [testGasketMaterial, setTestGasketMaterial] = React.useState("D_GASKET");
|
|
207
|
-
const [testInteriorFanlightMaterial, setTestInteriorFanlightMaterial] = React.useState("D_SRF_DECOR");
|
|
208
|
-
const [testExteriorFanlightMaterial, setTestExteriorFanlightMaterial] = React.useState("");
|
|
209
|
-
const [testOcculusInfillMaterial, setTestOcculusInfillMaterial] = React.useState("");
|
|
210
|
-
const [testGlassInfillMaterial, setTestGlassInfillMaterial] = React.useState("D_FR_COLOR");
|
|
211
|
-
const [testDoorStopMaterial, setTestDoorStopMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
212
|
-
const [testHingeMaterial, setTestHingeMaterial] = React.useState("");
|
|
213
|
-
const [testFrontCoverPanelMaterial, setTestFrontCoverPanelMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
214
|
-
const [testBackCoverPanelMaterial, setTestBackCoverPanelMaterial] = React.useState(getFirstValidValue(defaultOptions, hasValue));
|
|
215
|
-
const [testFrontDoorPlaneMaterial, setTestFrontDoorPlaneMaterial] = React.useState("D_SRF_DECOR_2");
|
|
216
|
-
const [testBackDoorPlaneMaterial, setTestBackDoorPlaneMaterial] = React.useState("D_SRF_DECOR");
|
|
217
196
|
const doorHeight = 0;
|
|
218
197
|
const [newPivotPosition, setNewPivotPosition] = React.useState(0);
|
|
219
198
|
const [parseMessage, setParseMessage] = React.useState({
|
|
@@ -358,28 +337,23 @@ const ConfiguratorProvider = _ref => {
|
|
|
358
337
|
// --- BodyType Effect ---
|
|
359
338
|
React.useEffect(() => {
|
|
360
339
|
let newDoorDepth = 40;
|
|
361
|
-
let newMaterial = "brown";
|
|
362
340
|
switch (bodyType) {
|
|
363
341
|
case "50":
|
|
364
342
|
newDoorDepth = 50;
|
|
365
343
|
break;
|
|
366
344
|
case "SG8":
|
|
367
345
|
newDoorDepth = 8;
|
|
368
|
-
newMaterial = "glass";
|
|
369
346
|
break;
|
|
370
347
|
case "SG10":
|
|
371
348
|
newDoorDepth = 10;
|
|
372
|
-
newMaterial = "glass";
|
|
373
349
|
break;
|
|
374
350
|
case "SG12":
|
|
375
351
|
newDoorDepth = 12;
|
|
376
|
-
newMaterial = "glass";
|
|
377
352
|
break;
|
|
378
353
|
}
|
|
379
354
|
setDoor(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
380
355
|
theDoorDepth: newDoorDepth
|
|
381
356
|
}));
|
|
382
|
-
setTestDoorMaterial(newMaterial);
|
|
383
357
|
}, [bodyType]);
|
|
384
358
|
|
|
385
359
|
// --- FrameType Effect ---
|
|
@@ -651,22 +625,19 @@ const ConfiguratorProvider = _ref => {
|
|
|
651
625
|
setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
652
626
|
depth: doorFrame.frameDepth
|
|
653
627
|
}));
|
|
654
|
-
setTestExteriorFanlightMaterial("metal");
|
|
655
628
|
break;
|
|
656
629
|
case "ALDGFL":
|
|
657
630
|
setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
658
631
|
depth: doorFrame.frameDepth
|
|
659
632
|
}));
|
|
660
|
-
setTestExteriorFanlightMaterial("glass");
|
|
661
633
|
break;
|
|
662
634
|
case "ALSGFL":
|
|
663
635
|
setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
664
636
|
depth: 40
|
|
665
637
|
}));
|
|
666
|
-
setTestExteriorFanlightMaterial("glass");
|
|
667
638
|
break;
|
|
668
639
|
}
|
|
669
|
-
}, [exteriorFanlight.visible, exteriorFanlightType, doorFrame.frameDepth,
|
|
640
|
+
}, [exteriorFanlight.visible, exteriorFanlightType, doorFrame.frameDepth, setExteriorFanlight]);
|
|
670
641
|
React.useEffect(() => {
|
|
671
642
|
setOcculus(prevOcculus => _objectSpread2(_objectSpread2({}, prevOcculus), {}, {
|
|
672
643
|
depth: door.theDoorDepth
|
|
@@ -729,32 +700,6 @@ const ConfiguratorProvider = _ref => {
|
|
|
729
700
|
setTotalWidth,
|
|
730
701
|
exteriorFanlightType,
|
|
731
702
|
setExteriorFanlightType,
|
|
732
|
-
testDoorMaterial,
|
|
733
|
-
setTestDoorMaterial,
|
|
734
|
-
testFrameMaterial,
|
|
735
|
-
setTestFrameMaterial,
|
|
736
|
-
testGasketMaterial,
|
|
737
|
-
setTestGasketMaterial,
|
|
738
|
-
testInteriorFanlightMaterial,
|
|
739
|
-
setTestInteriorFanlightMaterial,
|
|
740
|
-
testExteriorFanlightMaterial,
|
|
741
|
-
setTestExteriorFanlightMaterial,
|
|
742
|
-
testOcculusInfillMaterial,
|
|
743
|
-
setTestOcculusInfillMaterial,
|
|
744
|
-
testGlassInfillMaterial,
|
|
745
|
-
setTestGlassInfillMaterial,
|
|
746
|
-
testDoorStopMaterial,
|
|
747
|
-
setTestDoorStopMaterial,
|
|
748
|
-
testHingeMaterial,
|
|
749
|
-
setTestHingeMaterial,
|
|
750
|
-
testFrontCoverPanelMaterial,
|
|
751
|
-
setTestFrontCoverPanelMaterial,
|
|
752
|
-
testBackCoverPanelMaterial,
|
|
753
|
-
setTestBackCoverPanelMaterial,
|
|
754
|
-
testFrontDoorPlaneMaterial,
|
|
755
|
-
setTestFrontDoorPlaneMaterial,
|
|
756
|
-
testBackDoorPlaneMaterial,
|
|
757
|
-
setTestBackDoorPlaneMaterial,
|
|
758
703
|
glassVisible,
|
|
759
704
|
setGlassVisible,
|
|
760
705
|
glassDepth,
|
|
@@ -777,22 +722,22 @@ const useConfigurator = () => {
|
|
|
777
722
|
return context;
|
|
778
723
|
};
|
|
779
724
|
|
|
780
|
-
//
|
|
725
|
+
// Re-use the same loader instance to leverage Three.js's caching
|
|
781
726
|
const textureLoader = new THREE__namespace.TextureLoader();
|
|
782
727
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
};
|
|
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
|
+
*/
|
|
792
735
|
const createMaterialFromProp = value => {
|
|
793
|
-
if (!value)
|
|
736
|
+
if (!value) {
|
|
737
|
+
return null; // Return null if the prop is empty
|
|
738
|
+
}
|
|
794
739
|
|
|
795
|
-
//
|
|
740
|
+
// Check if the value is a hexadecimal color code
|
|
796
741
|
if (value.startsWith("#")) {
|
|
797
742
|
return new THREE__namespace.MeshStandardMaterial({
|
|
798
743
|
color: value,
|
|
@@ -800,40 +745,33 @@ const createMaterialFromProp = value => {
|
|
|
800
745
|
});
|
|
801
746
|
}
|
|
802
747
|
|
|
803
|
-
//
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
808
|
-
return new THREE__namespace.MeshStandardMaterial({
|
|
809
|
-
map: texture,
|
|
810
|
-
roughness: 0.8
|
|
811
|
-
});
|
|
812
|
-
}
|
|
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;
|
|
813
752
|
|
|
814
|
-
//
|
|
815
|
-
|
|
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
|
+
});
|
|
816
759
|
};
|
|
817
|
-
|
|
818
|
-
// --- REMOVED THE ENTIRE `availableMaterials` OBJECT ---
|
|
819
|
-
// It is no longer needed.
|
|
820
|
-
|
|
821
|
-
// Keep placeholder materials as a fallback if a material prop isn't provided
|
|
822
|
-
const placeholderMaterial = new THREE__namespace.MeshStandardMaterial({
|
|
823
|
-
color: "#cccccc",
|
|
824
|
-
// A neutral grey
|
|
825
|
-
roughness: 0.8
|
|
826
|
-
});
|
|
827
|
-
const placeholderMaterialforFrames = new THREE__namespace.MeshStandardMaterial({
|
|
828
|
-
color: "#555555",
|
|
829
|
-
// A darker grey for frames
|
|
830
|
-
roughness: 0.8
|
|
831
|
-
});
|
|
832
|
-
|
|
833
760
|
const availableMaterials = {
|
|
834
761
|
black: new THREE__namespace.MeshStandardMaterial({
|
|
835
762
|
color: "#000000"
|
|
836
763
|
}),
|
|
764
|
+
metal: new THREE__namespace.MeshStandardMaterial({
|
|
765
|
+
color: "#aaaaaa",
|
|
766
|
+
metalness: 1.0,
|
|
767
|
+
roughness: 0.4
|
|
768
|
+
}),
|
|
769
|
+
glass: new THREE__namespace.MeshStandardMaterial({
|
|
770
|
+
color: "#ffffff",
|
|
771
|
+
roughness: 0.1,
|
|
772
|
+
transparent: true,
|
|
773
|
+
opacity: 0.7
|
|
774
|
+
}),
|
|
837
775
|
aluminum: new THREE__namespace.MeshStandardMaterial({
|
|
838
776
|
color: "#abb0aa",
|
|
839
777
|
metalness: 0.8,
|
|
@@ -853,8 +791,15 @@ const availableMaterials = {
|
|
|
853
791
|
envMapIntensity: 1.2
|
|
854
792
|
})
|
|
855
793
|
};
|
|
794
|
+
const placeholderMaterial = new THREE__namespace.MeshStandardMaterial({
|
|
795
|
+
color: "#cccccc",
|
|
796
|
+
roughness: 0.8
|
|
797
|
+
});
|
|
798
|
+
const placeholderMaterialforFrames = new THREE__namespace.MeshStandardMaterial({
|
|
799
|
+
color: "#000",
|
|
800
|
+
roughness: 0.8
|
|
801
|
+
});
|
|
856
802
|
|
|
857
|
-
// Custom hook for door handle calculations
|
|
858
803
|
function StandardHandle(_ref) {
|
|
859
804
|
let {
|
|
860
805
|
position,
|
|
@@ -961,7 +906,6 @@ function StandardHandle(_ref) {
|
|
|
961
906
|
// 👈 same Y as small rose
|
|
962
907
|
z + (z > 0 ? roseThickness : -roseThickness) // 👈 accounts for thickness
|
|
963
908
|
],
|
|
964
|
-
castShadow: true,
|
|
965
909
|
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
966
910
|
rotation: [Math.PI / 2, 0, 0],
|
|
967
911
|
position: [0, 0.0075, 0],
|
|
@@ -1286,7 +1230,6 @@ function DoorStopCuts(_ref6) {
|
|
|
1286
1230
|
stopDepth,
|
|
1287
1231
|
stopPositionZ,
|
|
1288
1232
|
centerZ,
|
|
1289
|
-
glassDepthOffset = 0,
|
|
1290
1233
|
material,
|
|
1291
1234
|
setName
|
|
1292
1235
|
} = _ref6;
|
|
@@ -1324,14 +1267,12 @@ function DoorModels(_ref7) {
|
|
|
1324
1267
|
is2D,
|
|
1325
1268
|
totalWidth,
|
|
1326
1269
|
totalHeight,
|
|
1327
|
-
isPlaneVisible,
|
|
1328
1270
|
isFrameVisible,
|
|
1329
1271
|
door,
|
|
1330
1272
|
doorFrame,
|
|
1331
1273
|
interiorFanlight,
|
|
1332
1274
|
exteriorFanlight,
|
|
1333
1275
|
occulus,
|
|
1334
|
-
glass,
|
|
1335
1276
|
frontCoverPanel,
|
|
1336
1277
|
backCoverPanel,
|
|
1337
1278
|
frontDoorPlane,
|
|
@@ -1339,22 +1280,8 @@ function DoorModels(_ref7) {
|
|
|
1339
1280
|
frameType,
|
|
1340
1281
|
bodyType,
|
|
1341
1282
|
exteriorFanlightType,
|
|
1342
|
-
testDoorMaterial,
|
|
1343
|
-
testFrameMaterial,
|
|
1344
|
-
testGasketMaterial,
|
|
1345
|
-
testInteriorFanlightMaterial,
|
|
1346
|
-
testExteriorFanlightMaterial,
|
|
1347
|
-
testOcculusInfillMaterial,
|
|
1348
|
-
testGlassInfillMaterial,
|
|
1349
|
-
testDoorStopMaterial,
|
|
1350
|
-
testHingeMaterial,
|
|
1351
1283
|
glassVisible,
|
|
1352
|
-
testFrontCoverPanelMaterial,
|
|
1353
|
-
testBackCoverPanelMaterial,
|
|
1354
|
-
testFrontDoorPlaneMaterial,
|
|
1355
|
-
testBackDoorPlaneMaterial,
|
|
1356
1284
|
glassDepth,
|
|
1357
|
-
cpid,
|
|
1358
1285
|
handleParseCpid,
|
|
1359
1286
|
isDoubleDoor,
|
|
1360
1287
|
materials
|
|
@@ -1364,41 +1291,6 @@ function DoorModels(_ref7) {
|
|
|
1364
1291
|
handleParseCpid(doorName);
|
|
1365
1292
|
}
|
|
1366
1293
|
}, [doorName, handleParseCpid]);
|
|
1367
|
-
|
|
1368
|
-
// here i get material names from context
|
|
1369
|
-
const {
|
|
1370
|
-
doorMaterial: doorMaterialName
|
|
1371
|
-
} = door;
|
|
1372
|
-
const {
|
|
1373
|
-
frameMaterial: frameMaterialName,
|
|
1374
|
-
gasketMaterial: gasketMaterialName,
|
|
1375
|
-
doorStopMaterial: doorStopMaterialName,
|
|
1376
|
-
hingeMaterial: hingeMaterialName
|
|
1377
|
-
} = doorFrame;
|
|
1378
|
-
const {
|
|
1379
|
-
material: interiorFanlightMaterialName
|
|
1380
|
-
} = interiorFanlight;
|
|
1381
|
-
const {
|
|
1382
|
-
material: exteriorFanlightMaterialName
|
|
1383
|
-
} = exteriorFanlight;
|
|
1384
|
-
const {
|
|
1385
|
-
material: occulusInfillMaterialName
|
|
1386
|
-
} = occulus;
|
|
1387
|
-
const {
|
|
1388
|
-
material: glassInfillMaterialName
|
|
1389
|
-
} = glass;
|
|
1390
|
-
const {
|
|
1391
|
-
material: frontCoverPanelMaterialName
|
|
1392
|
-
} = frontCoverPanel;
|
|
1393
|
-
const {
|
|
1394
|
-
material: backCoverPanelMaterialName
|
|
1395
|
-
} = backCoverPanel;
|
|
1396
|
-
const {
|
|
1397
|
-
material: frontDoorPlaneMaterialName
|
|
1398
|
-
} = frontDoorPlane;
|
|
1399
|
-
const {
|
|
1400
|
-
material: backDoorPlaneMaterialName
|
|
1401
|
-
} = backDoorPlane;
|
|
1402
1294
|
const pers = React.useMemo(() => {
|
|
1403
1295
|
const dynamicMaterials = {};
|
|
1404
1296
|
for (const key in materials) {
|
|
@@ -1409,26 +1301,29 @@ function DoorModels(_ref7) {
|
|
|
1409
1301
|
}
|
|
1410
1302
|
return dynamicMaterials;
|
|
1411
1303
|
}, [materials]);
|
|
1304
|
+
|
|
1412
1305
|
// --- Material Logic ---
|
|
1413
|
-
React.useMemo(() => placeholderMaterial, [
|
|
1414
|
-
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterialforFrames, [
|
|
1415
|
-
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials.black, [
|
|
1416
|
-
const doorStopMaterial = React.useMemo(() =>
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
React.useMemo(() => pers.
|
|
1431
|
-
React.useMemo(() => pers.
|
|
1306
|
+
React.useMemo(() => placeholderMaterial, []);
|
|
1307
|
+
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterialforFrames, [pers]);
|
|
1308
|
+
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials.black, [pers]);
|
|
1309
|
+
const doorStopMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || frameMaterial, [pers, frameMaterial]);
|
|
1310
|
+
const interiorFanlightMaterial = React.useMemo(() => pers.D_SRF_DECOR_2 || placeholderMaterial, [pers]);
|
|
1311
|
+
const exteriorFanlightMaterial = React.useMemo(() => {
|
|
1312
|
+
switch (exteriorFanlightType) {
|
|
1313
|
+
case "ALDGFL":
|
|
1314
|
+
case "ALSGFL":
|
|
1315
|
+
return availableMaterials.glass;
|
|
1316
|
+
default:
|
|
1317
|
+
return availableMaterials.metal;
|
|
1318
|
+
}
|
|
1319
|
+
}, [exteriorFanlightType]);
|
|
1320
|
+
React.useMemo(() => availableMaterials.glass, []);
|
|
1321
|
+
const glassInfillMaterial = React.useMemo(() => pers.D_FR_COLOR || availableMaterials.glass, [pers]);
|
|
1322
|
+
React.useMemo(() => availableMaterials.aluminum, []);
|
|
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]);
|
|
1432
1327
|
React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
1433
1328
|
color: "#1a1a1a",
|
|
1434
1329
|
roughness: 0.1
|
|
@@ -1455,8 +1350,7 @@ function DoorModels(_ref7) {
|
|
|
1455
1350
|
gasketWidth,
|
|
1456
1351
|
gasketDepth,
|
|
1457
1352
|
secondDoorStopWidth,
|
|
1458
|
-
secondDoorStopDepth
|
|
1459
|
-
secondDoorStopOffset
|
|
1353
|
+
secondDoorStopDepth
|
|
1460
1354
|
} = doorFrame;
|
|
1461
1355
|
const initialDoorHeight = React.useRef(doorHeight);
|
|
1462
1356
|
const {
|
|
@@ -1471,13 +1365,11 @@ function DoorModels(_ref7) {
|
|
|
1471
1365
|
depth: architraveDepth
|
|
1472
1366
|
} = frontCoverPanel;
|
|
1473
1367
|
const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlightHeightValue : 0;
|
|
1474
|
-
const mainDoorHeight = doorHeight - interiorFanlightHeight;
|
|
1475
1368
|
const topThkValue = parseInt(topThk) || 20;
|
|
1476
1369
|
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
1477
1370
|
|
|
1478
1371
|
// Convert dimensions from mm to meters
|
|
1479
1372
|
const doorWidthM = doorWidth / 1000;
|
|
1480
|
-
const mainDoorHeightM = mainDoorHeight / 1000;
|
|
1481
1373
|
const interiorFanlightHeightM = interiorFanlightHeight / 1000;
|
|
1482
1374
|
const totalOpeningHeightM = doorHeight / 1000;
|
|
1483
1375
|
const doorDepthM = theDoorDepth / 1000;
|
|
@@ -1539,18 +1431,6 @@ function DoorModels(_ref7) {
|
|
|
1539
1431
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
1540
1432
|
const leftGlass_Z = -frameDepthM / 2 + GlassPanelDepthM / 2 - GlassPanelDepthM;
|
|
1541
1433
|
const rightGlass_Z = frameDepthM / 2 - GlassPanelDepthM / 2 + GlassPanelDepthM;
|
|
1542
|
-
// --- PIVOT ---
|
|
1543
|
-
const hingeZ = React.useMemo(() => {
|
|
1544
|
-
if (frameType === "WF_FLI") {
|
|
1545
|
-
if (isOpeningIn) {
|
|
1546
|
-
return doorCenterZ - doorDepthM / 2;
|
|
1547
|
-
} else {
|
|
1548
|
-
return doorCenterZ + doorDepthM / 2;
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
return isOpeningIn ? -frameDepthM / 2 : frameDepthM / 2;
|
|
1552
|
-
}, [frameType, isOpeningIn, doorCenterZ, doorDepthM, frameDepthM]);
|
|
1553
|
-
React.useMemo(() => doorCenterZ - hingeZ, [doorCenterZ, hingeZ]);
|
|
1554
1434
|
const directionMultiplier = doorOpening === "in" ? 1 : -1;
|
|
1555
1435
|
three.useSpring({
|
|
1556
1436
|
rotation: isOpen ? [0, (doorPivot === "left" ? Math.PI / 2 : -Math.PI / 2) * directionMultiplier, 0] : [0, 0, 0],
|
|
@@ -1562,9 +1442,6 @@ function DoorModels(_ref7) {
|
|
|
1562
1442
|
});
|
|
1563
1443
|
const totalFrameWidth = totalOpeningWidthM + sidesFrameWidthM * 2;
|
|
1564
1444
|
const totalFrameHeightM = totalOpeningHeightM + topFrameWidthM;
|
|
1565
|
-
|
|
1566
|
-
// --- Centering Logic ---
|
|
1567
|
-
(initialDoorHeight.current || doorHeight) / 1000;
|
|
1568
1445
|
const yCenteringOffset = -topFrameWidthM / 2;
|
|
1569
1446
|
const sideFrameCenterY = topFrameWidthM / 2;
|
|
1570
1447
|
const interiorFanlightYPosition = totalOpeningHeightM / 2 - interiorFanlightHeightM / 2;
|
|
@@ -1579,8 +1456,6 @@ function DoorModels(_ref7) {
|
|
|
1579
1456
|
const rightArchitraveX = totalOpeningWidthM / 2 + architraveProfileM / 2;
|
|
1580
1457
|
const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
|
|
1581
1458
|
const topArchitraveWidth = totalOpeningWidthM + 2 * architraveProfileM;
|
|
1582
|
-
|
|
1583
|
-
// --- Primary Gasket Edge Position Calculations ---
|
|
1584
1459
|
const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1585
1460
|
const leftGasketXPosition = -totalOpeningWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
|
|
1586
1461
|
const rightGasketXPosition = totalOpeningWidthM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
@@ -1590,8 +1465,6 @@ function DoorModels(_ref7) {
|
|
|
1590
1465
|
const secondTopGasketYPosition = totalOpeningHeightM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1591
1466
|
const secondLeftGasketXPosition = -totalOpeningWidthM / 2 + secondDoorStopWidthM - gasketWidthM / 2;
|
|
1592
1467
|
const secondRightGasketXPosition = totalOpeningWidthM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
|
|
1593
|
-
|
|
1594
|
-
// --- HINGE VISIBILITY LOGIC ---
|
|
1595
1468
|
const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
|
|
1596
1469
|
const pivotNewPosition = React.useMemo(() => {
|
|
1597
1470
|
if (initialDoorHeight.current === null || initialDoorHeight.current === 0) {
|
|
@@ -1599,31 +1472,6 @@ function DoorModels(_ref7) {
|
|
|
1599
1472
|
}
|
|
1600
1473
|
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1601
1474
|
}, [doorHeight]);
|
|
1602
|
-
|
|
1603
|
-
// Calculate evenly spaced hinge positions
|
|
1604
|
-
React.useMemo(() => {
|
|
1605
|
-
const numHinges = 4;
|
|
1606
|
-
const topMargin = 180 / 1000;
|
|
1607
|
-
const bottomMargin = 180 / 1000;
|
|
1608
|
-
const availableHeight = mainDoorHeightM - topMargin - bottomMargin;
|
|
1609
|
-
const spacing = availableHeight / (numHinges - 1);
|
|
1610
|
-
const positions = [];
|
|
1611
|
-
for (let i = 0; i < numHinges; i++) {
|
|
1612
|
-
positions.push(mainDoorHeightM / 2 - topMargin - i * spacing);
|
|
1613
|
-
}
|
|
1614
|
-
return positions;
|
|
1615
|
-
}, [mainDoorHeightM]);
|
|
1616
|
-
|
|
1617
|
-
// Y positions for the new glass hinges
|
|
1618
|
-
React.useMemo(() => {
|
|
1619
|
-
const topMargin = 250 / 1000;
|
|
1620
|
-
const secondTopMargin = 450 / 1000;
|
|
1621
|
-
const bottomMargin = 250 / 1000;
|
|
1622
|
-
const top = mainDoorHeightM / 2 - topMargin;
|
|
1623
|
-
const secondTop = mainDoorHeightM / 2 - secondTopMargin;
|
|
1624
|
-
const bottom = -mainDoorHeightM / 2 + bottomMargin;
|
|
1625
|
-
return [top, secondTop, bottom];
|
|
1626
|
-
}, [mainDoorHeightM]);
|
|
1627
1475
|
React.useMemo(() => {
|
|
1628
1476
|
if (isGlassDoor) return false;
|
|
1629
1477
|
if (!isFrameVisible) return false;
|
|
@@ -1951,80 +1799,18 @@ function DoorLeaf(_ref8) {
|
|
|
1951
1799
|
xOffset
|
|
1952
1800
|
} = _ref8;
|
|
1953
1801
|
const {
|
|
1954
|
-
is2D,
|
|
1955
|
-
totalWidth,
|
|
1956
|
-
totalHeight,
|
|
1957
|
-
isPlaneVisible,
|
|
1958
|
-
isFrameVisible,
|
|
1959
1802
|
door,
|
|
1960
1803
|
doorFrame,
|
|
1961
1804
|
interiorFanlight,
|
|
1962
|
-
exteriorFanlight,
|
|
1963
1805
|
occulus,
|
|
1964
|
-
glass,
|
|
1965
|
-
frontCoverPanel,
|
|
1966
|
-
backCoverPanel,
|
|
1967
1806
|
frontDoorPlane,
|
|
1968
1807
|
backDoorPlane,
|
|
1969
1808
|
frameType,
|
|
1970
1809
|
bodyType,
|
|
1971
1810
|
exteriorFanlightType,
|
|
1972
|
-
testDoorMaterial,
|
|
1973
|
-
testFrameMaterial,
|
|
1974
|
-
testGasketMaterial,
|
|
1975
|
-
testInteriorFanlightMaterial,
|
|
1976
|
-
testExteriorFanlightMaterial,
|
|
1977
|
-
testOcculusInfillMaterial,
|
|
1978
|
-
testGlassInfillMaterial,
|
|
1979
|
-
testDoorStopMaterial,
|
|
1980
|
-
testHingeMaterial,
|
|
1981
1811
|
glassVisible,
|
|
1982
|
-
testFrontCoverPanelMaterial,
|
|
1983
|
-
testBackCoverPanelMaterial,
|
|
1984
|
-
testFrontDoorPlaneMaterial,
|
|
1985
|
-
testBackDoorPlaneMaterial,
|
|
1986
|
-
glassDepth,
|
|
1987
|
-
cpid,
|
|
1988
|
-
handleParseCpid,
|
|
1989
1812
|
materials
|
|
1990
1813
|
} = useConfigurator();
|
|
1991
|
-
|
|
1992
|
-
// here i get material names from context
|
|
1993
|
-
const {
|
|
1994
|
-
doorMaterial: doorMaterialName
|
|
1995
|
-
} = door;
|
|
1996
|
-
const {
|
|
1997
|
-
frameMaterial: frameMaterialName,
|
|
1998
|
-
gasketMaterial: gasketMaterialName,
|
|
1999
|
-
doorStopMaterial: doorStopMaterialName,
|
|
2000
|
-
hingeMaterial: hingeMaterialName
|
|
2001
|
-
} = doorFrame;
|
|
2002
|
-
const {
|
|
2003
|
-
material: interiorFanlightMaterialName
|
|
2004
|
-
} = interiorFanlight;
|
|
2005
|
-
const {
|
|
2006
|
-
material: exteriorFanlightMaterialName
|
|
2007
|
-
} = exteriorFanlight;
|
|
2008
|
-
const {
|
|
2009
|
-
material: occulusInfillMaterialName
|
|
2010
|
-
} = occulus;
|
|
2011
|
-
const {
|
|
2012
|
-
material: glassInfillMaterialName
|
|
2013
|
-
} = glass;
|
|
2014
|
-
const {
|
|
2015
|
-
material: frontCoverPanelMaterialName
|
|
2016
|
-
} = frontCoverPanel;
|
|
2017
|
-
const {
|
|
2018
|
-
material: backCoverPanelMaterialName
|
|
2019
|
-
} = backCoverPanel;
|
|
2020
|
-
const {
|
|
2021
|
-
material: frontDoorPlaneMaterialName
|
|
2022
|
-
} = frontDoorPlane;
|
|
2023
|
-
const {
|
|
2024
|
-
material: backDoorPlaneMaterialName
|
|
2025
|
-
} = backDoorPlane;
|
|
2026
|
-
|
|
2027
|
-
// --- Material Logic ---
|
|
2028
1814
|
const pers = React.useMemo(() => {
|
|
2029
1815
|
const dynamicMaterials = {};
|
|
2030
1816
|
for (const key in materials) {
|
|
@@ -2035,26 +1821,17 @@ function DoorLeaf(_ref8) {
|
|
|
2035
1821
|
}
|
|
2036
1822
|
return dynamicMaterials;
|
|
2037
1823
|
}, [materials]);
|
|
1824
|
+
|
|
2038
1825
|
// --- Material Logic ---
|
|
2039
|
-
const doorMaterial = React.useMemo(() =>
|
|
2040
|
-
const frameMaterial = React.useMemo(() => pers.D_PRF_COLOR || pers.D_FR_SRF_DECOR || pers.D_FR_SRF_DECOR_S2 || placeholderMaterialforFrames, [
|
|
2041
|
-
const gasketMaterial = React.useMemo(() => pers.D_GASKET || availableMaterials.black, [
|
|
2042
|
-
React.useMemo(() =>
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
React.useMemo(() =>
|
|
2046
|
-
React.useMemo(() => placeholderMaterial, [
|
|
2047
|
-
const
|
|
2048
|
-
const glassInfillMaterial = React.useMemo(() => placeholderMaterial, [testGlassInfillMaterial, glassInfillMaterialName]);
|
|
2049
|
-
const hingeBodyMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2050
|
-
color: "#d4d4d4",
|
|
2051
|
-
metalness: 1.0,
|
|
2052
|
-
roughness: 0.4
|
|
2053
|
-
}), [testHingeMaterial, hingeMaterialName]);
|
|
2054
|
-
React.useMemo(() => placeholderMaterial, [testFrontCoverPanelMaterial, frontCoverPanelMaterialName]);
|
|
2055
|
-
React.useMemo(() => placeholderMaterial, [testBackCoverPanelMaterial, backCoverPanelMaterialName]);
|
|
2056
|
-
React.useMemo(() => placeholderMaterial, [testFrontDoorPlaneMaterial, frontDoorPlaneMaterialName]);
|
|
2057
|
-
React.useMemo(() => placeholderMaterial, [testBackDoorPlaneMaterial, backDoorPlaneMaterialName]);
|
|
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]);
|
|
2058
1835
|
const hingeAccentMaterial = React.useMemo(() => new THREE__namespace.MeshStandardMaterial({
|
|
2059
1836
|
color: "#1a1a1a",
|
|
2060
1837
|
roughness: 0.1
|
|
@@ -2065,24 +1842,17 @@ function DoorLeaf(_ref8) {
|
|
|
2065
1842
|
doorWidth,
|
|
2066
1843
|
doorHeight,
|
|
2067
1844
|
theDoorDepth,
|
|
2068
|
-
doorPivot,
|
|
2069
1845
|
doorOpening
|
|
2070
1846
|
} = door;
|
|
2071
1847
|
const {
|
|
2072
1848
|
frameDepth,
|
|
2073
|
-
topThk,
|
|
2074
|
-
sidesThk,
|
|
2075
1849
|
doorStopWidth,
|
|
2076
1850
|
doorStopDepth,
|
|
2077
1851
|
doorStopOffset,
|
|
2078
|
-
notchWidth,
|
|
2079
|
-
notchDepth,
|
|
2080
|
-
notchposition,
|
|
2081
1852
|
gasketWidth,
|
|
2082
1853
|
gasketDepth,
|
|
2083
1854
|
secondDoorStopWidth,
|
|
2084
|
-
secondDoorStopDepth
|
|
2085
|
-
secondDoorStopOffset
|
|
1855
|
+
secondDoorStopDepth
|
|
2086
1856
|
} = doorFrame;
|
|
2087
1857
|
const initialDoorHeight = React.useRef(null);
|
|
2088
1858
|
const initialDoorWidth = React.useRef(null);
|
|
@@ -2097,10 +1867,6 @@ function DoorLeaf(_ref8) {
|
|
|
2097
1867
|
const {
|
|
2098
1868
|
height: interiorFanlightHeightValue
|
|
2099
1869
|
} = interiorFanlight;
|
|
2100
|
-
const {
|
|
2101
|
-
height: exteriorFanlightHeightValue,
|
|
2102
|
-
depth: exteriorFanlightDepthValue
|
|
2103
|
-
} = exteriorFanlight;
|
|
2104
1870
|
const {
|
|
2105
1871
|
x1: occulusX1,
|
|
2106
1872
|
x2: occulusX2,
|
|
@@ -2110,7 +1876,6 @@ function DoorLeaf(_ref8) {
|
|
|
2110
1876
|
} = occulus;
|
|
2111
1877
|
const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlightHeightValue : 0;
|
|
2112
1878
|
const mainDoorHeight = doorHeight - interiorFanlightHeight;
|
|
2113
|
-
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
2114
1879
|
|
|
2115
1880
|
// Convert dimensions from mm to meters
|
|
2116
1881
|
const doorWidthM = doorWidth / 1000;
|
|
@@ -2118,8 +1883,6 @@ function DoorLeaf(_ref8) {
|
|
|
2118
1883
|
const totalOpeningHeightM = doorHeight / 1000;
|
|
2119
1884
|
const doorDepthM = theDoorDepth / 1000;
|
|
2120
1885
|
const frameDepthM = frameDepth / 1000;
|
|
2121
|
-
const sidesFrameWidthM = sidesThkValue / 1000;
|
|
2122
|
-
exteriorFanlight.visible ? exteriorFanlightHeightValue / 1000 : 0;
|
|
2123
1886
|
const occulusX1M = occulusX1 / 1000;
|
|
2124
1887
|
const occulusX2M = occulusX2 / 1000;
|
|
2125
1888
|
const occulusY1M = occulusY1 / 1000;
|
|
@@ -2156,7 +1919,7 @@ function DoorLeaf(_ref8) {
|
|
|
2156
1919
|
}
|
|
2157
1920
|
}
|
|
2158
1921
|
}, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
|
|
2159
|
-
const GlassPanelDepthM =
|
|
1922
|
+
const GlassPanelDepthM = 8 / 1000;
|
|
2160
1923
|
const frontGlassOffsetZ = doorDepthM / 2 + GlassPanelDepthM / 2;
|
|
2161
1924
|
const backGlassOffsetZ = -doorDepthM / 2 - GlassPanelDepthM / 2;
|
|
2162
1925
|
const occulusWidthM = doorWidthM - occulusX1M - occulusX2M;
|
|
@@ -2165,7 +1928,6 @@ function DoorLeaf(_ref8) {
|
|
|
2165
1928
|
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
2166
1929
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2167
1930
|
const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
2168
|
-
// --- PIVOT ---
|
|
2169
1931
|
const hingeZ = React.useMemo(() => {
|
|
2170
1932
|
if (frameType === "WF_FLI") {
|
|
2171
1933
|
if (isOpeningIn) {
|
|
@@ -2232,18 +1994,16 @@ function DoorLeaf(_ref8) {
|
|
|
2232
1994
|
}, [mainDoorHeightM]);
|
|
2233
1995
|
const isStandardHingeVisible = React.useMemo(() => {
|
|
2234
1996
|
if (isGlassDoor) return false;
|
|
2235
|
-
if (!isFrameVisible) return false;
|
|
2236
1997
|
const invisibleFrameTypes = ["WDGF_WDG100", "WF_100", "WF_FLI"];
|
|
2237
1998
|
if (invisibleFrameTypes.includes(frameType)) {
|
|
2238
1999
|
return false;
|
|
2239
2000
|
}
|
|
2240
2001
|
return true;
|
|
2241
|
-
}, [
|
|
2002
|
+
}, [frameType, isGlassDoor]);
|
|
2242
2003
|
|
|
2243
2004
|
// --- DYNAMIC TEXTURE MATERIALS ---
|
|
2244
2005
|
const dynamicFrontDoorPlaneMaterial = React.useMemo(() => {
|
|
2245
|
-
const
|
|
2246
|
-
const newMaterial = sourceMaterial.clone();
|
|
2006
|
+
const newMaterial = frontDoorPlaneMaterial.clone();
|
|
2247
2007
|
if (newMaterial.map) {
|
|
2248
2008
|
newMaterial.map = newMaterial.map.clone();
|
|
2249
2009
|
newMaterial.map.needsUpdate = true;
|
|
@@ -2257,10 +2017,9 @@ function DoorLeaf(_ref8) {
|
|
|
2257
2017
|
console.log(repeatX, repeatY);
|
|
2258
2018
|
}
|
|
2259
2019
|
return newMaterial;
|
|
2260
|
-
}, [
|
|
2020
|
+
}, [frontDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2261
2021
|
const dynamicBackDoorPlaneMaterial = React.useMemo(() => {
|
|
2262
|
-
const
|
|
2263
|
-
const newMaterial = sourceMaterial.clone();
|
|
2022
|
+
const newMaterial = backDoorPlaneMaterial.clone();
|
|
2264
2023
|
if (newMaterial.map) {
|
|
2265
2024
|
newMaterial.map = newMaterial.map.clone();
|
|
2266
2025
|
newMaterial.map.needsUpdate = true;
|
|
@@ -2273,7 +2032,7 @@ function DoorLeaf(_ref8) {
|
|
|
2273
2032
|
newMaterial.map.repeat.set(repeatX, repeatY * 2);
|
|
2274
2033
|
}
|
|
2275
2034
|
return newMaterial;
|
|
2276
|
-
}, [
|
|
2035
|
+
}, [backDoorPlaneMaterial, mainDoorHeightM, doorWidthM]);
|
|
2277
2036
|
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
2278
2037
|
"position-x": xOffset,
|
|
2279
2038
|
children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
@@ -2323,10 +2082,10 @@ function DoorLeaf(_ref8) {
|
|
|
2323
2082
|
args: [hingeRadiusM, hingeRadiusM, separatorHeightM, 32]
|
|
2324
2083
|
})
|
|
2325
2084
|
})]
|
|
2326
|
-
}, "door-hinge-".concat(index))), isGlassDoor &&
|
|
2085
|
+
}, "door-hinge-".concat(index))), isGlassDoor && glassHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsx(GlassHinge, {
|
|
2327
2086
|
position: [0, y, doorOffsetZ + 0.0001],
|
|
2328
2087
|
pivot: pivot,
|
|
2329
|
-
frameSideWidth:
|
|
2088
|
+
frameSideWidth: 0,
|
|
2330
2089
|
doorDepthM: doorDepthM,
|
|
2331
2090
|
material: hingeBodyMaterial,
|
|
2332
2091
|
gasketMaterial: gasketMaterial
|
|
@@ -2351,7 +2110,6 @@ function DoorLeaf(_ref8) {
|
|
|
2351
2110
|
stopDepth: doorStopDepthM,
|
|
2352
2111
|
stopPositionZ: doorStopPositionZ,
|
|
2353
2112
|
centerZ: doorCenterZ,
|
|
2354
|
-
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2355
2113
|
material: doorMaterial,
|
|
2356
2114
|
setName: "1"
|
|
2357
2115
|
}), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
|
|
@@ -2362,7 +2120,6 @@ function DoorLeaf(_ref8) {
|
|
|
2362
2120
|
stopDepth: secondDoorStopDepthM,
|
|
2363
2121
|
stopPositionZ: secondDoorStopPositionZ,
|
|
2364
2122
|
centerZ: doorCenterZ,
|
|
2365
|
-
glassDepthOffset: GlassPanelDepthM / 2,
|
|
2366
2123
|
material: doorMaterial,
|
|
2367
2124
|
setName: "2"
|
|
2368
2125
|
}), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|