door_models 5.3.5 → 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 CHANGED
@@ -1485,7 +1485,16 @@ function DoorModels(_ref7) {
1485
1485
  secondDoorStopWidth,
1486
1486
  secondDoorStopDepth
1487
1487
  } = doorFrame;
1488
- const initialDoorHeight = React.useRef(doorHeight);
1488
+ const initialDoorHeight = React.useRef(null);
1489
+ React.useEffect(() => {
1490
+ if (initialDoorHeight.current === null && doorHeight > 0) {
1491
+ initialDoorHeight.current = doorHeight;
1492
+ }
1493
+ }, [doorHeight]);
1494
+ const pivotNewPosition = React.useMemo(() => {
1495
+ if (initialDoorHeight.current === null || initialDoorHeight.current === 0) return 0;
1496
+ return (doorHeight - initialDoorHeight.current) / 2 / 1000;
1497
+ }, [doorHeight]);
1489
1498
  const {
1490
1499
  height: interiorFanlightHeightValue
1491
1500
  } = interiorFanlight;
@@ -1557,10 +1566,6 @@ function DoorModels(_ref7) {
1557
1566
  x: 0
1558
1567
  }];
1559
1568
  }, [isDoubleDoor, doorWidthM, doorPivot]);
1560
- const pivotNewPosition = React.useMemo(() => {
1561
- if (!initialDoorHeight.current || initialDoorHeight.current === 0) return 0;
1562
- return (doorHeight - initialDoorHeight.current) / 2 / 1000;
1563
- }, [doorHeight]);
1564
1569
 
1565
1570
  // --- Centering & Positioning ---
1566
1571
  const yCenteringOffset = -topFrameWidthM / 2;
@@ -1920,8 +1925,7 @@ function DoorLeaf(_ref8) {
1920
1925
  doorWidth,
1921
1926
  doorHeight,
1922
1927
  theDoorDepth,
1923
- doorOpening,
1924
- doorName
1928
+ doorOpening
1925
1929
  } = door;
1926
1930
  const {
1927
1931
  frameDepth,
@@ -1936,19 +1940,10 @@ function DoorLeaf(_ref8) {
1936
1940
  } = doorFrame;
1937
1941
  const initialDoorHeight = React.useRef(null);
1938
1942
  React.useEffect(() => {
1939
- initialDoorHeight.current = null;
1940
- }, [doorName]);
1941
- React.useEffect(() => {
1942
- if (initialDoorHeight.current === null && doorHeight > 0) {
1943
+ if (doorHeight > 0 && initialDoorHeight.current === null) {
1943
1944
  initialDoorHeight.current = doorHeight;
1944
1945
  }
1945
1946
  }, [doorHeight]);
1946
- React.useMemo(() => {
1947
- if (initialDoorHeight.current === null) {
1948
- return 0;
1949
- }
1950
- return (doorHeight - initialDoorHeight.current) / 2 / 1000;
1951
- }, [doorHeight]);
1952
1947
  const {
1953
1948
  x1: occulusX1,
1954
1949
  x2: occulusX2,
@@ -1999,6 +1994,19 @@ function DoorLeaf(_ref8) {
1999
1994
  const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
2000
1995
  const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
2001
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]);
2002
2010
  const [isOpen, setIsOpen] = React.useState(false);
2003
2011
  const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
2004
2012