door_models 5.4.4 → 5.4.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 +94 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +94 -13
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -102,7 +102,10 @@ const ConfiguratorProvider = _ref => {
|
|
|
102
102
|
let {
|
|
103
103
|
children,
|
|
104
104
|
initialIs2D = false,
|
|
105
|
-
initialMaterials = {}
|
|
105
|
+
initialMaterials = {},
|
|
106
|
+
totalWidth: widthProp,
|
|
107
|
+
totalHeight: heightProp,
|
|
108
|
+
totalDepth: depthProp
|
|
106
109
|
} = _ref;
|
|
107
110
|
const [materials, setMaterials] = React.useState(initialMaterials);
|
|
108
111
|
const [is2D, setIs2D] = React.useState(initialIs2D);
|
|
@@ -111,6 +114,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
111
114
|
const [cpid, setCpid] = React.useState("");
|
|
112
115
|
const [totalHeight, setTotalHeight] = React.useState(2700);
|
|
113
116
|
const [totalWidth, setTotalWidth] = React.useState(974);
|
|
117
|
+
const [totalDepth, setTotalDepth] = React.useState(103);
|
|
114
118
|
const [glassVisible, setGlassVisible] = React.useState(false);
|
|
115
119
|
const [glassDepth, setGlassDepth] = React.useState(8);
|
|
116
120
|
const [isDoubleDoor, setIsDoubleDoor] = React.useState(false);
|
|
@@ -191,6 +195,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
191
195
|
material: "infill_material",
|
|
192
196
|
depth: 20
|
|
193
197
|
});
|
|
198
|
+
const [baseConfig, setBaseConfig] = React.useState(null);
|
|
194
199
|
const [frameType, setFrameType] = React.useState("AF20_40");
|
|
195
200
|
const [bodyType, setBodyType] = React.useState("40");
|
|
196
201
|
const [exteriorFanlightType, setExteriorFanlightType] = React.useState("WPFL");
|
|
@@ -200,6 +205,21 @@ const ConfiguratorProvider = _ref => {
|
|
|
200
205
|
type: "",
|
|
201
206
|
text: ""
|
|
202
207
|
});
|
|
208
|
+
React.useEffect(() => {
|
|
209
|
+
if (widthProp !== undefined) {
|
|
210
|
+
setTotalWidth(widthProp);
|
|
211
|
+
}
|
|
212
|
+
}, [widthProp]);
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
if (heightProp !== undefined) {
|
|
215
|
+
setTotalHeight(heightProp);
|
|
216
|
+
}
|
|
217
|
+
}, [heightProp]);
|
|
218
|
+
React.useEffect(() => {
|
|
219
|
+
if (depthProp !== undefined) {
|
|
220
|
+
setTotalDepth(depthProp);
|
|
221
|
+
}
|
|
222
|
+
}, [depthProp]);
|
|
203
223
|
React.useEffect(() => {
|
|
204
224
|
setIs2D(initialIs2D);
|
|
205
225
|
}, [initialIs2D]);
|
|
@@ -599,6 +619,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
599
619
|
};
|
|
600
620
|
break;
|
|
601
621
|
}
|
|
622
|
+
|
|
623
|
+
// Store pristine settings for scaling
|
|
624
|
+
setBaseConfig(newSettings);
|
|
602
625
|
const isMxCaf = frameType.startsWith("MXCAF");
|
|
603
626
|
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
604
627
|
visible: isMxCaf
|
|
@@ -616,8 +639,65 @@ const ConfiguratorProvider = _ref => {
|
|
|
616
639
|
theDoorDepth: doorDepth
|
|
617
640
|
}));
|
|
618
641
|
}
|
|
642
|
+
|
|
643
|
+
// Sync totalDepth with the frame's default depth when frame type changes.
|
|
644
|
+
if (newSettings.frameDepth) {
|
|
645
|
+
setTotalDepth(newSettings.frameDepth);
|
|
646
|
+
}
|
|
619
647
|
}, [frameType]);
|
|
620
648
|
|
|
649
|
+
// --- useEffect for scaling based on totalDepth ---
|
|
650
|
+
React.useEffect(() => {
|
|
651
|
+
if (!baseConfig || !baseConfig.frameDepth || baseConfig.frameDepth === 0) return;
|
|
652
|
+
const baseFrameDepth = baseConfig.frameDepth;
|
|
653
|
+
const ratio = totalDepth / baseFrameDepth;
|
|
654
|
+
const scaleProportionally = value => {
|
|
655
|
+
if (typeof value === "number") {
|
|
656
|
+
return value * ratio;
|
|
657
|
+
}
|
|
658
|
+
if (typeof value === "string" && value.endsWith("mm")) {
|
|
659
|
+
const num = parseFloat(value);
|
|
660
|
+
if (!isNaN(num)) {
|
|
661
|
+
return num * ratio + "mm";
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return value; // Return original if not scalable
|
|
665
|
+
};
|
|
666
|
+
setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
667
|
+
frameDepth: totalDepth,
|
|
668
|
+
doorStopDepth: scaleProportionally(baseConfig.doorStopDepth),
|
|
669
|
+
notchDepth: scaleProportionally(baseConfig.notchDepth),
|
|
670
|
+
gasketDepth: scaleProportionally(baseConfig.gasketDepth),
|
|
671
|
+
secondDoorStopDepth: scaleProportionally(baseConfig.secondDoorStopDepth)
|
|
672
|
+
}));
|
|
673
|
+
if (baseConfig.doorDepth !== undefined) {
|
|
674
|
+
const baseDoorDepth = baseConfig.doorDepth;
|
|
675
|
+
const frameDelta = totalDepth - baseFrameDepth;
|
|
676
|
+
let newDoorDepth;
|
|
677
|
+
if (frameDelta > 0) {
|
|
678
|
+
// --- THIS IS THE VALUE TO TWEAK ---
|
|
679
|
+
// Increase this multiplier to make the door body grow faster when totalDepth increases.
|
|
680
|
+
// A value of 1.0 means it grows at the same rate as the frame.
|
|
681
|
+
// A value of 2.0 means it grows twice as fast as the frame.
|
|
682
|
+
const increaseMultiplier = 0.8;
|
|
683
|
+
newDoorDepth = baseDoorDepth + frameDelta * increaseMultiplier;
|
|
684
|
+
} else {
|
|
685
|
+
// When decreasing totalDepth, the door body scales down proportionally.
|
|
686
|
+
newDoorDepth = baseDoorDepth * ratio;
|
|
687
|
+
}
|
|
688
|
+
setDoor(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
689
|
+
theDoorDepth: newDoorDepth
|
|
690
|
+
}));
|
|
691
|
+
}
|
|
692
|
+
const baseCoverPanelDepth = 12;
|
|
693
|
+
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
694
|
+
depth: baseCoverPanelDepth * ratio
|
|
695
|
+
}));
|
|
696
|
+
setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
697
|
+
depth: baseCoverPanelDepth * ratio
|
|
698
|
+
}));
|
|
699
|
+
}, [totalDepth, baseConfig]);
|
|
700
|
+
|
|
621
701
|
// --- Exterior Fanlight Logic ---
|
|
622
702
|
React.useEffect(() => {
|
|
623
703
|
if (!exteriorFanlight.visible) return;
|
|
@@ -698,6 +778,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
698
778
|
setBodyType,
|
|
699
779
|
totalHeight,
|
|
700
780
|
setTotalHeight,
|
|
781
|
+
totalDepth,
|
|
782
|
+
setTotalDepth,
|
|
701
783
|
totalWidth,
|
|
702
784
|
setTotalWidth,
|
|
703
785
|
exteriorFanlightType,
|
|
@@ -1428,7 +1510,7 @@ function DoorModels(_ref7) {
|
|
|
1428
1510
|
doorOpening: doorOpeningProp,
|
|
1429
1511
|
totalWidth: totalWidthProp,
|
|
1430
1512
|
totalHeight: totalHeightProp,
|
|
1431
|
-
|
|
1513
|
+
totalDepth: totalDepthProp
|
|
1432
1514
|
} = _ref7;
|
|
1433
1515
|
const {
|
|
1434
1516
|
is2D,
|
|
@@ -1449,7 +1531,8 @@ function DoorModels(_ref7) {
|
|
|
1449
1531
|
isDoubleDoor,
|
|
1450
1532
|
setMaterials,
|
|
1451
1533
|
setTotalWidth,
|
|
1452
|
-
setTotalHeight
|
|
1534
|
+
setTotalHeight,
|
|
1535
|
+
setTotalDepth
|
|
1453
1536
|
} = useConfigurator();
|
|
1454
1537
|
React.useEffect(() => {
|
|
1455
1538
|
if (doorName) {
|
|
@@ -1481,12 +1564,10 @@ function DoorModels(_ref7) {
|
|
|
1481
1564
|
}
|
|
1482
1565
|
}, [totalHeightProp, setTotalHeight]);
|
|
1483
1566
|
React.useEffect(() => {
|
|
1484
|
-
if (
|
|
1485
|
-
|
|
1486
|
-
frameDepth: frameDepthProp
|
|
1487
|
-
}));
|
|
1567
|
+
if (totalDepthProp !== undefined) {
|
|
1568
|
+
setTotalDepth(totalDepthProp);
|
|
1488
1569
|
}
|
|
1489
|
-
}, [
|
|
1570
|
+
}, [totalDepthProp, setTotalDepth]);
|
|
1490
1571
|
|
|
1491
1572
|
// --- Material Logic (Centralized in parent component) ---
|
|
1492
1573
|
const allMaterials = useDoorMaterials(materialsProp);
|
|
@@ -2290,18 +2371,18 @@ const DoorConfigurator = _ref => {
|
|
|
2290
2371
|
is2D = false,
|
|
2291
2372
|
totalWidth,
|
|
2292
2373
|
totalHeight,
|
|
2293
|
-
|
|
2374
|
+
totalDepth
|
|
2294
2375
|
} = _ref;
|
|
2295
2376
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2296
2377
|
initialIs2D: is2D,
|
|
2378
|
+
totalWidth: totalWidth,
|
|
2379
|
+
totalHeight: totalHeight,
|
|
2380
|
+
totalDepth: totalDepth,
|
|
2297
2381
|
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
2298
2382
|
doorName: doorName,
|
|
2299
2383
|
materials: materials,
|
|
2300
2384
|
doorPivot: doorPivot,
|
|
2301
|
-
doorOpening: doorOpening
|
|
2302
|
-
totalWidth: totalWidth,
|
|
2303
|
-
totalHeight: totalHeight,
|
|
2304
|
-
frameDepth: frameDepth
|
|
2385
|
+
doorOpening: doorOpening
|
|
2305
2386
|
})
|
|
2306
2387
|
});
|
|
2307
2388
|
};
|