door_models 5.3.4 → 5.3.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 +19 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -24
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1485,7 +1485,24 @@ function DoorModels(_ref7) {
|
|
|
1485
1485
|
secondDoorStopWidth,
|
|
1486
1486
|
secondDoorStopDepth
|
|
1487
1487
|
} = doorFrame;
|
|
1488
|
-
const initialDoorHeight = React.useRef(
|
|
1488
|
+
const initialDoorHeight = React.useRef(null);
|
|
1489
|
+
React.useEffect(() => {
|
|
1490
|
+
// If our initial height hasn't been set yet AND we have a valid height...
|
|
1491
|
+
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
|
+
initialDoorHeight.current = doorHeight;
|
|
1495
|
+
}
|
|
1496
|
+
}, [doorHeight]); // This hook listens for changes to doorHeight
|
|
1497
|
+
|
|
1498
|
+
// YOUR ORIGINAL LOGIC IS UNCHANGED, we just add a safety check.
|
|
1499
|
+
const pivotNewPosition = React.useMemo(() => {
|
|
1500
|
+
// If the initial value hasn't been captured, don't move the door.
|
|
1501
|
+
if (initialDoorHeight.current === null || initialDoorHeight.current === 0) return 0;
|
|
1502
|
+
|
|
1503
|
+
// Your existing, correct logic now works because initialDoorHeight.current is correct.
|
|
1504
|
+
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1505
|
+
}, [doorHeight]);
|
|
1489
1506
|
const {
|
|
1490
1507
|
height: interiorFanlightHeightValue
|
|
1491
1508
|
} = interiorFanlight;
|
|
@@ -1557,10 +1574,6 @@ function DoorModels(_ref7) {
|
|
|
1557
1574
|
x: 0
|
|
1558
1575
|
}];
|
|
1559
1576
|
}, [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
1577
|
|
|
1565
1578
|
// --- Centering & Positioning ---
|
|
1566
1579
|
const yCenteringOffset = -topFrameWidthM / 2;
|
|
@@ -1920,8 +1933,7 @@ function DoorLeaf(_ref8) {
|
|
|
1920
1933
|
doorWidth,
|
|
1921
1934
|
doorHeight,
|
|
1922
1935
|
theDoorDepth,
|
|
1923
|
-
doorOpening
|
|
1924
|
-
doorName
|
|
1936
|
+
doorOpening
|
|
1925
1937
|
} = door;
|
|
1926
1938
|
const {
|
|
1927
1939
|
frameDepth,
|
|
@@ -1935,23 +1947,6 @@ function DoorLeaf(_ref8) {
|
|
|
1935
1947
|
secondDoorStopDepth
|
|
1936
1948
|
} = doorFrame;
|
|
1937
1949
|
const initialDoorHeight = React.useRef(null);
|
|
1938
|
-
React.useEffect(() => {
|
|
1939
|
-
initialDoorHeight.current = null;
|
|
1940
|
-
}, [doorName]);
|
|
1941
|
-
React.useEffect(() => {
|
|
1942
|
-
if (initialDoorHeight.current === null && doorHeight > 0) {
|
|
1943
|
-
initialDoorHeight.current = doorHeight;
|
|
1944
|
-
}
|
|
1945
|
-
}, [doorHeight]);
|
|
1946
|
-
React.useMemo(() => {
|
|
1947
|
-
if (initialDoorHeight.current === null) {
|
|
1948
|
-
return 0;
|
|
1949
|
-
}
|
|
1950
|
-
return (doorHeight - initialDoorHeight.current) / 2 / 1000;
|
|
1951
|
-
}, [doorHeight]);
|
|
1952
|
-
|
|
1953
|
-
// Old
|
|
1954
|
-
|
|
1955
1950
|
React.useEffect(() => {
|
|
1956
1951
|
if (doorHeight > 0 && initialDoorHeight.current === null) {
|
|
1957
1952
|
initialDoorHeight.current = doorHeight;
|