door_models 5.3.6 → 5.3.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 +14 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1487,20 +1487,12 @@ function DoorModels(_ref7) {
|
|
|
1487
1487
|
} = doorFrame;
|
|
1488
1488
|
const initialDoorHeight = React.useRef(null);
|
|
1489
1489
|
React.useEffect(() => {
|
|
1490
|
-
// If our initial height hasn't been set yet AND we have a valid height...
|
|
1491
1490
|
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
1491
|
initialDoorHeight.current = doorHeight;
|
|
1495
1492
|
}
|
|
1496
|
-
}, [doorHeight]);
|
|
1497
|
-
|
|
1498
|
-
// YOUR ORIGINAL LOGIC IS UNCHANGED, we just add a safety check.
|
|
1493
|
+
}, [doorHeight]);
|
|
1499
1494
|
const pivotNewPosition = React.useMemo(() => {
|
|
1500
|
-
// If the initial value hasn't been captured, don't move the door.
|
|
1501
1495
|
if (initialDoorHeight.current === null || initialDoorHeight.current === 0) return 0;
|
|
1502
|
-
|
|
1503
|
-
// Your existing, correct logic now works because initialDoorHeight.current is correct.
|
|
1504
1496
|
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1505
1497
|
}, [doorHeight]);
|
|
1506
1498
|
const {
|
|
@@ -2002,6 +1994,19 @@ function DoorLeaf(_ref8) {
|
|
|
2002
1994
|
const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
|
|
2003
1995
|
const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
|
|
2004
1996
|
const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
|
|
1997
|
+
React.useEffect(() => {
|
|
1998
|
+
const materialsToUpdate = [frontDoorPlaneMaterial, backDoorPlaneMaterial];
|
|
1999
|
+
materialsToUpdate.forEach(material => {
|
|
2000
|
+
// Check if the material has a texture map
|
|
2001
|
+
if (material.map) {
|
|
2002
|
+
// Set the texture to repeat
|
|
2003
|
+
material.map.wrapS = THREE__namespace.RepeatWrapping;
|
|
2004
|
+
material.map.wrapT = THREE__namespace.RepeatWrapping;
|
|
2005
|
+
material.map.repeat.set(doorWidthM, mainDoorHeightM);
|
|
2006
|
+
material.map.needsUpdate = true;
|
|
2007
|
+
}
|
|
2008
|
+
});
|
|
2009
|
+
}, [doorWidthM, mainDoorHeightM, frontDoorPlaneMaterial, backDoorPlaneMaterial]);
|
|
2005
2010
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2006
2011
|
const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
|
|
2007
2012
|
|