door_models 5.4.4 → 5.4.5
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 +72 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +72 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -111,6 +111,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
111
111
|
const [cpid, setCpid] = React.useState("");
|
|
112
112
|
const [totalHeight, setTotalHeight] = React.useState(2700);
|
|
113
113
|
const [totalWidth, setTotalWidth] = React.useState(974);
|
|
114
|
+
const [totalDepth, setTotalDepth] = React.useState(103);
|
|
114
115
|
const [glassVisible, setGlassVisible] = React.useState(false);
|
|
115
116
|
const [glassDepth, setGlassDepth] = React.useState(8);
|
|
116
117
|
const [isDoubleDoor, setIsDoubleDoor] = React.useState(false);
|
|
@@ -191,6 +192,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
191
192
|
material: "infill_material",
|
|
192
193
|
depth: 20
|
|
193
194
|
});
|
|
195
|
+
const [baseConfig, setBaseConfig] = React.useState(null);
|
|
194
196
|
const [frameType, setFrameType] = React.useState("AF20_40");
|
|
195
197
|
const [bodyType, setBodyType] = React.useState("40");
|
|
196
198
|
const [exteriorFanlightType, setExteriorFanlightType] = React.useState("WPFL");
|
|
@@ -599,6 +601,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
599
601
|
};
|
|
600
602
|
break;
|
|
601
603
|
}
|
|
604
|
+
|
|
605
|
+
// Store pristine settings for scaling
|
|
606
|
+
setBaseConfig(newSettings);
|
|
602
607
|
const isMxCaf = frameType.startsWith("MXCAF");
|
|
603
608
|
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
604
609
|
visible: isMxCaf
|
|
@@ -616,8 +621,65 @@ const ConfiguratorProvider = _ref => {
|
|
|
616
621
|
theDoorDepth: doorDepth
|
|
617
622
|
}));
|
|
618
623
|
}
|
|
624
|
+
|
|
625
|
+
// Sync totalDepth with the frame's default depth when frame type changes.
|
|
626
|
+
if (newSettings.frameDepth) {
|
|
627
|
+
setTotalDepth(newSettings.frameDepth);
|
|
628
|
+
}
|
|
619
629
|
}, [frameType]);
|
|
620
630
|
|
|
631
|
+
// --- useEffect for scaling based on totalDepth ---
|
|
632
|
+
React.useEffect(() => {
|
|
633
|
+
if (!baseConfig || !baseConfig.frameDepth || baseConfig.frameDepth === 0) return;
|
|
634
|
+
const baseFrameDepth = baseConfig.frameDepth;
|
|
635
|
+
const ratio = totalDepth / baseFrameDepth;
|
|
636
|
+
const scaleProportionally = value => {
|
|
637
|
+
if (typeof value === "number") {
|
|
638
|
+
return value * ratio;
|
|
639
|
+
}
|
|
640
|
+
if (typeof value === "string" && value.endsWith("mm")) {
|
|
641
|
+
const num = parseFloat(value);
|
|
642
|
+
if (!isNaN(num)) {
|
|
643
|
+
return num * ratio + "mm";
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return value; // Return original if not scalable
|
|
647
|
+
};
|
|
648
|
+
setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
649
|
+
frameDepth: totalDepth,
|
|
650
|
+
doorStopDepth: scaleProportionally(baseConfig.doorStopDepth),
|
|
651
|
+
notchDepth: scaleProportionally(baseConfig.notchDepth),
|
|
652
|
+
gasketDepth: scaleProportionally(baseConfig.gasketDepth),
|
|
653
|
+
secondDoorStopDepth: scaleProportionally(baseConfig.secondDoorStopDepth)
|
|
654
|
+
}));
|
|
655
|
+
if (baseConfig.doorDepth !== undefined) {
|
|
656
|
+
const baseDoorDepth = baseConfig.doorDepth;
|
|
657
|
+
const frameDelta = totalDepth - baseFrameDepth;
|
|
658
|
+
let newDoorDepth;
|
|
659
|
+
if (frameDelta > 0) {
|
|
660
|
+
// --- THIS IS THE VALUE TO TWEAK ---
|
|
661
|
+
// Increase this multiplier to make the door body grow faster when totalDepth increases.
|
|
662
|
+
// A value of 1.0 means it grows at the same rate as the frame.
|
|
663
|
+
// A value of 2.0 means it grows twice as fast as the frame.
|
|
664
|
+
const increaseMultiplier = 0.8;
|
|
665
|
+
newDoorDepth = baseDoorDepth + frameDelta * increaseMultiplier;
|
|
666
|
+
} else {
|
|
667
|
+
// When decreasing totalDepth, the door body scales down proportionally.
|
|
668
|
+
newDoorDepth = baseDoorDepth * ratio;
|
|
669
|
+
}
|
|
670
|
+
setDoor(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
671
|
+
theDoorDepth: newDoorDepth
|
|
672
|
+
}));
|
|
673
|
+
}
|
|
674
|
+
const baseCoverPanelDepth = 12;
|
|
675
|
+
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
676
|
+
depth: baseCoverPanelDepth * ratio
|
|
677
|
+
}));
|
|
678
|
+
setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
679
|
+
depth: baseCoverPanelDepth * ratio
|
|
680
|
+
}));
|
|
681
|
+
}, [totalDepth, baseConfig]);
|
|
682
|
+
|
|
621
683
|
// --- Exterior Fanlight Logic ---
|
|
622
684
|
React.useEffect(() => {
|
|
623
685
|
if (!exteriorFanlight.visible) return;
|
|
@@ -698,6 +760,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
698
760
|
setBodyType,
|
|
699
761
|
totalHeight,
|
|
700
762
|
setTotalHeight,
|
|
763
|
+
totalDepth,
|
|
764
|
+
setTotalDepth,
|
|
701
765
|
totalWidth,
|
|
702
766
|
setTotalWidth,
|
|
703
767
|
exteriorFanlightType,
|
|
@@ -1428,7 +1492,7 @@ function DoorModels(_ref7) {
|
|
|
1428
1492
|
doorOpening: doorOpeningProp,
|
|
1429
1493
|
totalWidth: totalWidthProp,
|
|
1430
1494
|
totalHeight: totalHeightProp,
|
|
1431
|
-
|
|
1495
|
+
totalDepth: totalDepthProp
|
|
1432
1496
|
} = _ref7;
|
|
1433
1497
|
const {
|
|
1434
1498
|
is2D,
|
|
@@ -1449,7 +1513,8 @@ function DoorModels(_ref7) {
|
|
|
1449
1513
|
isDoubleDoor,
|
|
1450
1514
|
setMaterials,
|
|
1451
1515
|
setTotalWidth,
|
|
1452
|
-
setTotalHeight
|
|
1516
|
+
setTotalHeight,
|
|
1517
|
+
setTotalDepth
|
|
1453
1518
|
} = useConfigurator();
|
|
1454
1519
|
React.useEffect(() => {
|
|
1455
1520
|
if (doorName) {
|
|
@@ -1481,12 +1546,10 @@ function DoorModels(_ref7) {
|
|
|
1481
1546
|
}
|
|
1482
1547
|
}, [totalHeightProp, setTotalHeight]);
|
|
1483
1548
|
React.useEffect(() => {
|
|
1484
|
-
if (
|
|
1485
|
-
|
|
1486
|
-
frameDepth: frameDepthProp
|
|
1487
|
-
}));
|
|
1549
|
+
if (totalDepthProp !== undefined) {
|
|
1550
|
+
setTotalDepth(totalDepthProp);
|
|
1488
1551
|
}
|
|
1489
|
-
}, [
|
|
1552
|
+
}, [totalDepthProp, setTotalDepth]);
|
|
1490
1553
|
|
|
1491
1554
|
// --- Material Logic (Centralized in parent component) ---
|
|
1492
1555
|
const allMaterials = useDoorMaterials(materialsProp);
|
|
@@ -2290,7 +2353,7 @@ const DoorConfigurator = _ref => {
|
|
|
2290
2353
|
is2D = false,
|
|
2291
2354
|
totalWidth,
|
|
2292
2355
|
totalHeight,
|
|
2293
|
-
|
|
2356
|
+
totalDepth
|
|
2294
2357
|
} = _ref;
|
|
2295
2358
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2296
2359
|
initialIs2D: is2D,
|
|
@@ -2301,7 +2364,7 @@ const DoorConfigurator = _ref => {
|
|
|
2301
2364
|
doorOpening: doorOpening,
|
|
2302
2365
|
totalWidth: totalWidth,
|
|
2303
2366
|
totalHeight: totalHeight,
|
|
2304
|
-
|
|
2367
|
+
totalDepth: totalDepth
|
|
2305
2368
|
})
|
|
2306
2369
|
});
|
|
2307
2370
|
};
|