door_models 5.3.6 → 5.3.8
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 +49 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -29
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -804,8 +804,6 @@ new THREE__namespace.MeshStandardMaterial({
|
|
|
804
804
|
roughness: 0.8
|
|
805
805
|
});
|
|
806
806
|
|
|
807
|
-
// Type definition for a material prop (string or object with opacity)
|
|
808
|
-
|
|
809
807
|
// Helper function to check for hex color codes
|
|
810
808
|
const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
|
|
811
809
|
|
|
@@ -830,13 +828,9 @@ const buildMaterial = (prop, textures) => {
|
|
|
830
828
|
};
|
|
831
829
|
if (isHexColor(sourceValue)) {
|
|
832
830
|
params.color = sourceValue;
|
|
833
|
-
}
|
|
834
|
-
// Check if it's a URL and if it exists in the pre-loaded texture map
|
|
835
|
-
else if (textures && textures[sourceValue]) {
|
|
831
|
+
} else if (textures && textures[sourceValue]) {
|
|
836
832
|
params.map = textures[sourceValue];
|
|
837
|
-
}
|
|
838
|
-
// Fallback for invalid values
|
|
839
|
-
else {
|
|
833
|
+
} else {
|
|
840
834
|
params.color = "#cccccc";
|
|
841
835
|
}
|
|
842
836
|
if (opacity !== undefined && opacity < 1) {
|
|
@@ -845,8 +839,6 @@ const buildMaterial = (prop, textures) => {
|
|
|
845
839
|
}
|
|
846
840
|
return new THREE__namespace.MeshStandardMaterial(params);
|
|
847
841
|
};
|
|
848
|
-
|
|
849
|
-
// getFirstValidValue remains useful for fallbacks, so we keep it.
|
|
850
842
|
const getFirstValidValue = values => {
|
|
851
843
|
for (const val of values) {
|
|
852
844
|
if (val) {
|
|
@@ -1413,7 +1405,10 @@ function DoorModels(_ref7) {
|
|
|
1413
1405
|
doorName,
|
|
1414
1406
|
materials: materialsProp,
|
|
1415
1407
|
doorPivot: doorPivotProp,
|
|
1416
|
-
doorOpening: doorOpeningProp
|
|
1408
|
+
doorOpening: doorOpeningProp,
|
|
1409
|
+
totalWidth: totalWidthProp,
|
|
1410
|
+
totalHeight: totalHeightProp,
|
|
1411
|
+
frameDepth: frameDepthProp
|
|
1417
1412
|
} = _ref7;
|
|
1418
1413
|
const {
|
|
1419
1414
|
is2D,
|
|
@@ -1422,6 +1417,7 @@ function DoorModels(_ref7) {
|
|
|
1422
1417
|
door,
|
|
1423
1418
|
setDoor,
|
|
1424
1419
|
doorFrame,
|
|
1420
|
+
setDoorFrame,
|
|
1425
1421
|
interiorFanlight,
|
|
1426
1422
|
exteriorFanlight,
|
|
1427
1423
|
frontCoverPanel,
|
|
@@ -1431,7 +1427,9 @@ function DoorModels(_ref7) {
|
|
|
1431
1427
|
glassDepth,
|
|
1432
1428
|
handleParseCpid,
|
|
1433
1429
|
isDoubleDoor,
|
|
1434
|
-
setMaterials
|
|
1430
|
+
setMaterials,
|
|
1431
|
+
setTotalWidth,
|
|
1432
|
+
setTotalHeight
|
|
1435
1433
|
} = useConfigurator();
|
|
1436
1434
|
React.useEffect(() => {
|
|
1437
1435
|
if (doorName) {
|
|
@@ -1443,12 +1441,6 @@ function DoorModels(_ref7) {
|
|
|
1443
1441
|
setMaterials(materialsProp);
|
|
1444
1442
|
}
|
|
1445
1443
|
}, [materialsProp, setMaterials]);
|
|
1446
|
-
React.useEffect(() => {
|
|
1447
|
-
if (doorName) handleParseCpid(doorName);
|
|
1448
|
-
}, [doorName, handleParseCpid]);
|
|
1449
|
-
React.useEffect(() => {
|
|
1450
|
-
if (materialsProp) setMaterials(materialsProp);
|
|
1451
|
-
}, [materialsProp, setMaterials]);
|
|
1452
1444
|
React.useEffect(() => {
|
|
1453
1445
|
if (doorPivotProp || doorOpeningProp) {
|
|
1454
1446
|
setDoor(prevDoor => _objectSpread2(_objectSpread2(_objectSpread2({}, prevDoor), doorPivotProp && {
|
|
@@ -1458,6 +1450,23 @@ function DoorModels(_ref7) {
|
|
|
1458
1450
|
}));
|
|
1459
1451
|
}
|
|
1460
1452
|
}, [doorPivotProp, doorOpeningProp, setDoor]);
|
|
1453
|
+
React.useEffect(() => {
|
|
1454
|
+
if (totalWidthProp !== undefined) {
|
|
1455
|
+
setTotalWidth(totalWidthProp);
|
|
1456
|
+
}
|
|
1457
|
+
}, [totalWidthProp, setTotalWidth]);
|
|
1458
|
+
React.useEffect(() => {
|
|
1459
|
+
if (totalHeightProp !== undefined) {
|
|
1460
|
+
setTotalHeight(totalHeightProp);
|
|
1461
|
+
}
|
|
1462
|
+
}, [totalHeightProp, setTotalHeight]);
|
|
1463
|
+
React.useEffect(() => {
|
|
1464
|
+
if (frameDepthProp !== undefined) {
|
|
1465
|
+
setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
1466
|
+
frameDepth: frameDepthProp
|
|
1467
|
+
}));
|
|
1468
|
+
}
|
|
1469
|
+
}, [frameDepthProp, setDoorFrame]);
|
|
1461
1470
|
|
|
1462
1471
|
// --- Material Logic (Centralized in parent component) ---
|
|
1463
1472
|
const allMaterials = useDoorMaterials(materialsProp);
|
|
@@ -1487,20 +1496,12 @@ function DoorModels(_ref7) {
|
|
|
1487
1496
|
} = doorFrame;
|
|
1488
1497
|
const initialDoorHeight = React.useRef(null);
|
|
1489
1498
|
React.useEffect(() => {
|
|
1490
|
-
// If our initial height hasn't been set yet AND we have a valid height...
|
|
1491
1499
|
if (initialDoorHeight.current === null && doorHeight > 0) {
|
|
1492
|
-
// ...set it. This will now be the stable base value for your logic.
|
|
1493
|
-
// This line will only run once for the initial valid height.
|
|
1494
1500
|
initialDoorHeight.current = doorHeight;
|
|
1495
1501
|
}
|
|
1496
|
-
}, [doorHeight]);
|
|
1497
|
-
|
|
1498
|
-
// YOUR ORIGINAL LOGIC IS UNCHANGED, we just add a safety check.
|
|
1502
|
+
}, [doorHeight]);
|
|
1499
1503
|
const pivotNewPosition = React.useMemo(() => {
|
|
1500
|
-
// If the initial value hasn't been captured, don't move the door.
|
|
1501
1504
|
if (initialDoorHeight.current === null || initialDoorHeight.current === 0) return 0;
|
|
1502
|
-
|
|
1503
|
-
// Your existing, correct logic now works because initialDoorHeight.current is correct.
|
|
1504
1505
|
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1505
1506
|
}, [doorHeight]);
|
|
1506
1507
|
const {
|
|
@@ -2002,6 +2003,19 @@ function DoorLeaf(_ref8) {
|
|
|
2002
2003
|
const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
|
|
2003
2004
|
const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
|
|
2004
2005
|
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
2006
|
+
React.useEffect(() => {
|
|
2007
|
+
const materialsToUpdate = [frontDoorPlaneMaterial, backDoorPlaneMaterial];
|
|
2008
|
+
materialsToUpdate.forEach(material => {
|
|
2009
|
+
// Check if the material has a texture map
|
|
2010
|
+
if (material.map) {
|
|
2011
|
+
// Set the texture to repeat
|
|
2012
|
+
material.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2013
|
+
material.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2014
|
+
material.map.repeat.set(doorWidthM, mainDoorHeightM);
|
|
2015
|
+
material.map.needsUpdate = true;
|
|
2016
|
+
}
|
|
2017
|
+
});
|
|
2018
|
+
}, [doorWidthM, mainDoorHeightM, frontDoorPlaneMaterial, backDoorPlaneMaterial]);
|
|
2005
2019
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2006
2020
|
const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
2007
2021
|
|
|
@@ -2246,7 +2260,10 @@ const DoorConfigurator = _ref => {
|
|
|
2246
2260
|
materials,
|
|
2247
2261
|
doorPivot,
|
|
2248
2262
|
doorOpening,
|
|
2249
|
-
is2D = false
|
|
2263
|
+
is2D = false,
|
|
2264
|
+
totalWidth,
|
|
2265
|
+
totalHeight,
|
|
2266
|
+
frameDepth
|
|
2250
2267
|
} = _ref;
|
|
2251
2268
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2252
2269
|
initialIs2D: is2D,
|
|
@@ -2254,7 +2271,10 @@ const DoorConfigurator = _ref => {
|
|
|
2254
2271
|
doorName: doorName,
|
|
2255
2272
|
materials: materials,
|
|
2256
2273
|
doorPivot: doorPivot,
|
|
2257
|
-
doorOpening: doorOpening
|
|
2274
|
+
doorOpening: doorOpening,
|
|
2275
|
+
totalWidth: totalWidth,
|
|
2276
|
+
totalHeight: totalHeight,
|
|
2277
|
+
frameDepth: frameDepth
|
|
2258
2278
|
})
|
|
2259
2279
|
});
|
|
2260
2280
|
};
|