door_models 5.3.8 → 5.4.0
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 +56 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +56 -21
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -102,7 +102,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
102
102
|
let {
|
|
103
103
|
children,
|
|
104
104
|
initialIs2D = false,
|
|
105
|
-
initialMaterials = {}
|
|
105
|
+
initialMaterials = {},
|
|
106
|
+
totalDepth
|
|
106
107
|
} = _ref;
|
|
107
108
|
const [materials, setMaterials] = React.useState(initialMaterials);
|
|
108
109
|
const [is2D, setIs2D] = React.useState(initialIs2D);
|
|
@@ -599,13 +600,35 @@ const ConfiguratorProvider = _ref => {
|
|
|
599
600
|
};
|
|
600
601
|
break;
|
|
601
602
|
}
|
|
603
|
+
const baseTotalDepth = 103; // Define the reference depth for scaling (103mm is a common default)
|
|
604
|
+
const scaleFactor = totalDepth !== undefined && baseTotalDepth > 0 ? totalDepth / baseTotalDepth : 1;
|
|
605
|
+
|
|
606
|
+
// Apply the scaling factor to all depth-related settings
|
|
607
|
+
if (scaleFactor !== 1) {
|
|
608
|
+
if (newSettings.frameDepth !== undefined) newSettings.frameDepth *= scaleFactor;
|
|
609
|
+
if (newSettings.doorDepth !== undefined) newSettings.doorDepth *= scaleFactor;
|
|
610
|
+
if (newSettings.doorStopDepth !== undefined) newSettings.doorStopDepth *= scaleFactor;
|
|
611
|
+
if (newSettings.secondDoorStopDepth !== undefined) newSettings.secondDoorStopDepth *= scaleFactor;
|
|
612
|
+
if (newSettings.gasketDepth !== undefined) newSettings.gasketDepth *= scaleFactor;
|
|
613
|
+
|
|
614
|
+
// Handle string-based depths like "40mm" for notchDepth
|
|
615
|
+
if (typeof newSettings.notchDepth === "string") {
|
|
616
|
+
const num = parseInt(newSettings.notchDepth, 10);
|
|
617
|
+
if (!isNaN(num)) {
|
|
618
|
+
newSettings.notchDepth = "".concat(num * scaleFactor, "mm");
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
602
622
|
const isMxCaf = frameType.startsWith("MXCAF");
|
|
603
623
|
setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
604
|
-
visible: isMxCaf
|
|
624
|
+
visible: isMxCaf,
|
|
625
|
+
depth: 12 * scaleFactor
|
|
605
626
|
}));
|
|
606
627
|
setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
607
|
-
visible: isMxCaf
|
|
628
|
+
visible: isMxCaf,
|
|
629
|
+
depth: 12 * scaleFactor
|
|
608
630
|
}));
|
|
631
|
+
setGlassDepth(8 * scaleFactor);
|
|
609
632
|
const {
|
|
610
633
|
doorDepth
|
|
611
634
|
} = newSettings,
|
|
@@ -616,7 +639,7 @@ const ConfiguratorProvider = _ref => {
|
|
|
616
639
|
theDoorDepth: doorDepth
|
|
617
640
|
}));
|
|
618
641
|
}
|
|
619
|
-
}, [frameType]);
|
|
642
|
+
}, [frameType, totalDepth]);
|
|
620
643
|
|
|
621
644
|
// --- Exterior Fanlight Logic ---
|
|
622
645
|
React.useEffect(() => {
|
|
@@ -824,14 +847,15 @@ const buildMaterial = (prop, textures) => {
|
|
|
824
847
|
const sourceValue = typeof prop === "string" ? prop : prop.value;
|
|
825
848
|
const opacity = typeof prop === "object" ? prop.opacity : 1;
|
|
826
849
|
const params = {
|
|
827
|
-
roughness: 0.8
|
|
850
|
+
roughness: 0.8,
|
|
851
|
+
side: THREE__namespace.DoubleSide
|
|
828
852
|
};
|
|
829
853
|
if (isHexColor(sourceValue)) {
|
|
830
854
|
params.color = sourceValue;
|
|
831
855
|
} else if (textures && textures[sourceValue]) {
|
|
832
856
|
params.map = textures[sourceValue];
|
|
833
857
|
} else {
|
|
834
|
-
params.color = "
|
|
858
|
+
params.color = "yellow";
|
|
835
859
|
}
|
|
836
860
|
if (opacity !== undefined && opacity < 1) {
|
|
837
861
|
params.transparent = true;
|
|
@@ -1520,6 +1544,8 @@ function DoorModels(_ref7) {
|
|
|
1520
1544
|
const sidesThkValue = parseInt(sidesThk) || 20;
|
|
1521
1545
|
|
|
1522
1546
|
// Convert dimensions from mm to meters
|
|
1547
|
+
const totalWidthM = totalWidthProp !== undefined ? totalWidthProp / 1000 : totalWidth / 1000;
|
|
1548
|
+
const totalHeightM = totalHeightProp !== undefined ? totalHeightProp / 1000 : doorHeight / 1000;
|
|
1523
1549
|
const interiorFanlightHeightM = interiorFanlightHeight / 1000;
|
|
1524
1550
|
const doorWidthM = doorWidth / 1000;
|
|
1525
1551
|
const totalOpeningHeightM = doorHeight / 1000;
|
|
@@ -1609,8 +1635,13 @@ function DoorModels(_ref7) {
|
|
|
1609
1635
|
})
|
|
1610
1636
|
});
|
|
1611
1637
|
}
|
|
1612
|
-
return /*#__PURE__*/jsxRuntime.
|
|
1613
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
1638
|
+
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1639
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
1640
|
+
visible: false,
|
|
1641
|
+
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1642
|
+
args: [totalWidthM, totalHeightM, frameDepthM]
|
|
1643
|
+
})
|
|
1644
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1614
1645
|
"position-y": yCenteringOffset + pivotNewPosition,
|
|
1615
1646
|
children: [frontCoverPanel.visible && /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1616
1647
|
"position-z": frontArchitraveZ,
|
|
@@ -1888,7 +1919,7 @@ function DoorModels(_ref7) {
|
|
|
1888
1919
|
xOffset: instance.x,
|
|
1889
1920
|
materials: allMaterials
|
|
1890
1921
|
}, instance.key))]
|
|
1891
|
-
})
|
|
1922
|
+
})]
|
|
1892
1923
|
});
|
|
1893
1924
|
}
|
|
1894
1925
|
|
|
@@ -2263,20 +2294,24 @@ const DoorConfigurator = _ref => {
|
|
|
2263
2294
|
is2D = false,
|
|
2264
2295
|
totalWidth,
|
|
2265
2296
|
totalHeight,
|
|
2266
|
-
|
|
2297
|
+
totalDepth // Destructure the new prop
|
|
2267
2298
|
} = _ref;
|
|
2268
|
-
return
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2299
|
+
return (
|
|
2300
|
+
/*#__PURE__*/
|
|
2301
|
+
// Pass the totalDepth prop to the Provider
|
|
2302
|
+
jsxRuntime.jsx(ConfiguratorProvider, {
|
|
2303
|
+
initialIs2D: is2D,
|
|
2304
|
+
totalDepth: totalDepth,
|
|
2305
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
2306
|
+
doorName: doorName,
|
|
2307
|
+
materials: materials,
|
|
2308
|
+
doorPivot: doorPivot,
|
|
2309
|
+
doorOpening: doorOpening,
|
|
2310
|
+
totalWidth: totalWidth,
|
|
2311
|
+
totalHeight: totalHeight
|
|
2312
|
+
})
|
|
2278
2313
|
})
|
|
2279
|
-
|
|
2314
|
+
);
|
|
2280
2315
|
};
|
|
2281
2316
|
|
|
2282
2317
|
exports["default"] = DoorConfigurator;
|