door_models 4.0.0 → 4.0.2
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 +199 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +200 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs.js
CHANGED
|
@@ -96,8 +96,10 @@ const _excluded = ["doorDepth"];
|
|
|
96
96
|
const ConfiguratorContext = /*#__PURE__*/react.createContext(undefined);
|
|
97
97
|
const ConfiguratorProvider = _ref => {
|
|
98
98
|
let {
|
|
99
|
-
children
|
|
99
|
+
children,
|
|
100
|
+
initialIs2D = false
|
|
100
101
|
} = _ref;
|
|
102
|
+
const [is2D, setIs2D] = react.useState(initialIs2D);
|
|
101
103
|
const [isPlaneVisible, setIsPlaneVisible] = react.useState(false);
|
|
102
104
|
const [isFrameVisible, setIsFrameVisible] = react.useState(true);
|
|
103
105
|
const [cpid, setCpid] = react.useState("");
|
|
@@ -194,6 +196,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
194
196
|
type: "",
|
|
195
197
|
text: ""
|
|
196
198
|
});
|
|
199
|
+
react.useEffect(() => {
|
|
200
|
+
setIs2D(initialIs2D);
|
|
201
|
+
}, [initialIs2D]);
|
|
197
202
|
const handleParseCpid = react.useCallback(cpidToParse => {
|
|
198
203
|
const showMessage = function (text) {
|
|
199
204
|
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
|
|
@@ -630,6 +635,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
630
635
|
}, [totalWidth, doorFrame.sidesThk]);
|
|
631
636
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorContext.Provider, {
|
|
632
637
|
value: {
|
|
638
|
+
is2D,
|
|
639
|
+
setIs2D,
|
|
633
640
|
isPlaneVisible,
|
|
634
641
|
setIsPlaneVisible,
|
|
635
642
|
isFrameVisible,
|
|
@@ -763,7 +770,159 @@ const availableMaterials = {
|
|
|
763
770
|
envMapIntensity: 1.5
|
|
764
771
|
})
|
|
765
772
|
};
|
|
766
|
-
function
|
|
773
|
+
function StandardHandle(_ref) {
|
|
774
|
+
let {
|
|
775
|
+
position,
|
|
776
|
+
doorDepthM,
|
|
777
|
+
doorPivot
|
|
778
|
+
} = _ref;
|
|
779
|
+
// --- Basic Dimensions ---
|
|
780
|
+
const roseRadius = 0.03;
|
|
781
|
+
const roseThickness = 0.006;
|
|
782
|
+
const stemRadius = 0.007;
|
|
783
|
+
const leverRadius = 0.009;
|
|
784
|
+
const leverLength = 0.12;
|
|
785
|
+
const metal = availableMaterials.silver;
|
|
786
|
+
const faceZ = doorDepthM / 2 + roseThickness / 2;
|
|
787
|
+
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
788
|
+
position: position,
|
|
789
|
+
rotation: [0, 0, 0],
|
|
790
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
791
|
+
"position-z": faceZ,
|
|
792
|
+
material: metal,
|
|
793
|
+
castShadow: true,
|
|
794
|
+
receiveShadow: true,
|
|
795
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
796
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
797
|
+
args: [roseRadius, roseRadius, roseThickness, 48]
|
|
798
|
+
})
|
|
799
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
800
|
+
"scale-x": doorPivot === "left" ? -1 : 1,
|
|
801
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
802
|
+
"position-z": doorDepthM / 2 + stemRadius,
|
|
803
|
+
material: metal,
|
|
804
|
+
castShadow: true,
|
|
805
|
+
receiveShadow: true,
|
|
806
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
807
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
808
|
+
args: [stemRadius, stemRadius, 0.02, 32]
|
|
809
|
+
})
|
|
810
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
811
|
+
position: [0.06, 0, doorDepthM / 2],
|
|
812
|
+
material: metal,
|
|
813
|
+
castShadow: true,
|
|
814
|
+
receiveShadow: true,
|
|
815
|
+
rotation: [0, 0, Math.PI / 2],
|
|
816
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
817
|
+
args: [leverRadius, leverRadius, leverLength, 32]
|
|
818
|
+
})
|
|
819
|
+
})]
|
|
820
|
+
})]
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
function GlassHandle(_ref2) {
|
|
824
|
+
let {
|
|
825
|
+
position,
|
|
826
|
+
doorDepthM,
|
|
827
|
+
doorPivot
|
|
828
|
+
} = _ref2;
|
|
829
|
+
// --- Dimensions and materials ---
|
|
830
|
+
const roseRadius = 0.025;
|
|
831
|
+
const roseThickness = 0.005;
|
|
832
|
+
const stemRadius = 0.005;
|
|
833
|
+
const leverRadius = 0.008;
|
|
834
|
+
const leverLength = 0.12;
|
|
835
|
+
const bendRadius = 0.012;
|
|
836
|
+
const metal = availableMaterials.silver;
|
|
837
|
+
const glassMaterial = availableMaterials.glass;
|
|
838
|
+
const faceZ = doorDepthM / 2 + roseThickness / 2;
|
|
839
|
+
return /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
840
|
+
position: position,
|
|
841
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
842
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
843
|
+
"position-z": faceZ,
|
|
844
|
+
material: metal,
|
|
845
|
+
castShadow: true,
|
|
846
|
+
receiveShadow: true,
|
|
847
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
848
|
+
args: [roseRadius, roseRadius * 0.92, roseThickness, 48]
|
|
849
|
+
})
|
|
850
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
851
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
852
|
+
"position-z": -faceZ,
|
|
853
|
+
material: metal,
|
|
854
|
+
castShadow: true,
|
|
855
|
+
receiveShadow: true,
|
|
856
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
857
|
+
args: [roseRadius, roseRadius * 0.92, roseThickness, 48]
|
|
858
|
+
})
|
|
859
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
860
|
+
"position-z": faceZ + 0.001,
|
|
861
|
+
material: glassMaterial,
|
|
862
|
+
castShadow: true,
|
|
863
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
864
|
+
args: [roseRadius * 0.4, roseRadius * 0.4, roseThickness * 0.8, 32]
|
|
865
|
+
})
|
|
866
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
867
|
+
"scale-x": doorPivot === "left" ? -1 : 1,
|
|
868
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
869
|
+
"position-z": doorDepthM / 2 + bendRadius,
|
|
870
|
+
material: metal,
|
|
871
|
+
castShadow: true,
|
|
872
|
+
receiveShadow: true,
|
|
873
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
874
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
875
|
+
args: [stemRadius, stemRadius, bendRadius, 24]
|
|
876
|
+
})
|
|
877
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
878
|
+
position: [bendRadius, 0, doorDepthM / 2],
|
|
879
|
+
material: metal,
|
|
880
|
+
castShadow: true,
|
|
881
|
+
receiveShadow: true,
|
|
882
|
+
children: /*#__PURE__*/jsxRuntime.jsx("torusGeometry", {
|
|
883
|
+
args: [bendRadius, stemRadius, 20, 48, Math.PI / 2]
|
|
884
|
+
})
|
|
885
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
886
|
+
position: [bendRadius + leverLength / 2, 0, doorDepthM / 2],
|
|
887
|
+
material: metal,
|
|
888
|
+
castShadow: true,
|
|
889
|
+
receiveShadow: true,
|
|
890
|
+
rotation: [0, 0, Math.PI / 2],
|
|
891
|
+
children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
|
|
892
|
+
args: [leverRadius, leverRadius * 0.8, leverLength, 32]
|
|
893
|
+
})
|
|
894
|
+
}), /*#__PURE__*/jsxRuntime.jsx("mesh", {
|
|
895
|
+
position: [bendRadius + leverLength, 0, doorDepthM / 2],
|
|
896
|
+
material: metal,
|
|
897
|
+
castShadow: true,
|
|
898
|
+
children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
|
|
899
|
+
args: [leverRadius * 0.8, 12, 12]
|
|
900
|
+
})
|
|
901
|
+
})]
|
|
902
|
+
})]
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
function DoorHandle(_ref3) {
|
|
906
|
+
let {
|
|
907
|
+
bodyType,
|
|
908
|
+
handleX,
|
|
909
|
+
handleHeightM,
|
|
910
|
+
doorDepthM,
|
|
911
|
+
doorPivot
|
|
912
|
+
} = _ref3;
|
|
913
|
+
const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
|
|
914
|
+
const handlePos = [handleX, handleHeightM, 0];
|
|
915
|
+
return isSingleGlass ? /*#__PURE__*/jsxRuntime.jsx(GlassHandle, {
|
|
916
|
+
position: handlePos,
|
|
917
|
+
doorDepthM: doorDepthM,
|
|
918
|
+
doorPivot: doorPivot
|
|
919
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(StandardHandle, {
|
|
920
|
+
position: handlePos,
|
|
921
|
+
doorDepthM: doorDepthM,
|
|
922
|
+
doorPivot: doorPivot
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function GlassHinge(_ref4) {
|
|
767
926
|
let {
|
|
768
927
|
position,
|
|
769
928
|
pivot,
|
|
@@ -771,7 +930,7 @@ function GlassHinge(_ref) {
|
|
|
771
930
|
doorDepthM,
|
|
772
931
|
material,
|
|
773
932
|
gasketMaterial
|
|
774
|
-
} =
|
|
933
|
+
} = _ref4;
|
|
775
934
|
const plateWidth = 130 / 1000;
|
|
776
935
|
const plateHeight = 55 / 1000;
|
|
777
936
|
const plateThickness = 8 / 1000;
|
|
@@ -847,7 +1006,7 @@ function GlassHinge(_ref) {
|
|
|
847
1006
|
})]
|
|
848
1007
|
});
|
|
849
1008
|
}
|
|
850
|
-
function DoorStopCuts(
|
|
1009
|
+
function DoorStopCuts(_ref5) {
|
|
851
1010
|
let {
|
|
852
1011
|
visible,
|
|
853
1012
|
width,
|
|
@@ -859,7 +1018,7 @@ function DoorStopCuts(_ref2) {
|
|
|
859
1018
|
glassDepthOffset = 0,
|
|
860
1019
|
material,
|
|
861
1020
|
setName
|
|
862
|
-
} =
|
|
1021
|
+
} = _ref5;
|
|
863
1022
|
if (!visible) return null;
|
|
864
1023
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
865
1024
|
children: [/*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
|
|
@@ -886,11 +1045,14 @@ function DoorStopCuts(_ref2) {
|
|
|
886
1045
|
})]
|
|
887
1046
|
});
|
|
888
1047
|
}
|
|
889
|
-
function DoorModels(
|
|
1048
|
+
function DoorModels(_ref6) {
|
|
890
1049
|
let {
|
|
891
1050
|
doorName
|
|
892
|
-
} =
|
|
1051
|
+
} = _ref6;
|
|
893
1052
|
const {
|
|
1053
|
+
is2D,
|
|
1054
|
+
totalWidth,
|
|
1055
|
+
totalHeight,
|
|
894
1056
|
isPlaneVisible,
|
|
895
1057
|
isFrameVisible,
|
|
896
1058
|
door,
|
|
@@ -1142,6 +1304,15 @@ function DoorModels(_ref3) {
|
|
|
1142
1304
|
const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
|
|
1143
1305
|
const topArchitraveWidth = doorWidthM + 2 * architraveProfileM;
|
|
1144
1306
|
|
|
1307
|
+
// --- Handle placement ---
|
|
1308
|
+
// Handle local placement on the DOOR LEAF so it follows rotation
|
|
1309
|
+
const handleCenterYFromDoorBottom = 1.0; // 1000 mm from bottom by default
|
|
1310
|
+
const safeHandleY = Math.min(Math.max(handleCenterYFromDoorBottom, 0.25), mainDoorHeightM - 0.25);
|
|
1311
|
+
const handleHeightM = -mainDoorHeightM / 2 + safeHandleY; // convert to door local Y
|
|
1312
|
+
const latchMarginM = 0.08; // 80 mm from latch edge
|
|
1313
|
+
const nonHingeSideX = doorPivot === "left" ? doorWidthM / 2 : -doorWidthM / 2;
|
|
1314
|
+
const handleX = nonHingeSideX + (doorPivot === "left" ? -latchMarginM : latchMarginM);
|
|
1315
|
+
|
|
1145
1316
|
// --- Primary Gasket Edge Position Calculations ---
|
|
1146
1317
|
const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
|
|
1147
1318
|
const leftGasketXPosition = -doorWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
|
|
@@ -1195,6 +1366,18 @@ function DoorModels(_ref3) {
|
|
|
1195
1366
|
}
|
|
1196
1367
|
return true;
|
|
1197
1368
|
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
1369
|
+
if (is2D) {
|
|
1370
|
+
return /*#__PURE__*/jsxRuntime.jsx("group", {
|
|
1371
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("mesh", {
|
|
1372
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1373
|
+
args: [totalWidth / 1000, 0.1, frameDepth / 1000]
|
|
1374
|
+
}), /*#__PURE__*/jsxRuntime.jsx("meshBasicMaterial", {
|
|
1375
|
+
color: "white",
|
|
1376
|
+
side: THREE__namespace.DoubleSide
|
|
1377
|
+
})]
|
|
1378
|
+
})
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1198
1381
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1199
1382
|
children: [frontCoverPanel.visible && /*#__PURE__*/jsxRuntime.jsxs("group", {
|
|
1200
1383
|
"position-z": frontArchitraveZ,
|
|
@@ -1593,6 +1776,12 @@ function DoorModels(_ref3) {
|
|
|
1593
1776
|
children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
|
|
1594
1777
|
args: [occulusWidthM, occulusHeightM, occulusInfillDepthM]
|
|
1595
1778
|
})
|
|
1779
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DoorHandle, {
|
|
1780
|
+
bodyType: bodyType,
|
|
1781
|
+
handleX: handleX,
|
|
1782
|
+
handleHeightM: handleHeightM,
|
|
1783
|
+
doorDepthM: doorDepthM,
|
|
1784
|
+
doorPivot: doorPivot
|
|
1596
1785
|
})]
|
|
1597
1786
|
})]
|
|
1598
1787
|
}), isPlaneVisible && /*#__PURE__*/jsxRuntime.jsxs("mesh", {
|
|
@@ -1612,9 +1801,11 @@ function DoorModels(_ref3) {
|
|
|
1612
1801
|
const DoorConfigurator = _ref => {
|
|
1613
1802
|
let {
|
|
1614
1803
|
doorName,
|
|
1615
|
-
showInterface = true
|
|
1804
|
+
showInterface = true,
|
|
1805
|
+
is2D = false
|
|
1616
1806
|
} = _ref;
|
|
1617
1807
|
return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
|
|
1808
|
+
initialIs2D: is2D,
|
|
1618
1809
|
children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
|
|
1619
1810
|
doorName: doorName
|
|
1620
1811
|
})
|