door_models 4.0.1 → 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 CHANGED
@@ -770,7 +770,159 @@ const availableMaterials = {
770
770
  envMapIntensity: 1.5
771
771
  })
772
772
  };
773
- function GlassHinge(_ref) {
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) {
774
926
  let {
775
927
  position,
776
928
  pivot,
@@ -778,7 +930,7 @@ function GlassHinge(_ref) {
778
930
  doorDepthM,
779
931
  material,
780
932
  gasketMaterial
781
- } = _ref;
933
+ } = _ref4;
782
934
  const plateWidth = 130 / 1000;
783
935
  const plateHeight = 55 / 1000;
784
936
  const plateThickness = 8 / 1000;
@@ -854,7 +1006,7 @@ function GlassHinge(_ref) {
854
1006
  })]
855
1007
  });
856
1008
  }
857
- function DoorStopCuts(_ref2) {
1009
+ function DoorStopCuts(_ref5) {
858
1010
  let {
859
1011
  visible,
860
1012
  width,
@@ -866,7 +1018,7 @@ function DoorStopCuts(_ref2) {
866
1018
  glassDepthOffset = 0,
867
1019
  material,
868
1020
  setName
869
- } = _ref2;
1021
+ } = _ref5;
870
1022
  if (!visible) return null;
871
1023
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
872
1024
  children: [/*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
@@ -893,10 +1045,10 @@ function DoorStopCuts(_ref2) {
893
1045
  })]
894
1046
  });
895
1047
  }
896
- function DoorModels(_ref3) {
1048
+ function DoorModels(_ref6) {
897
1049
  let {
898
1050
  doorName
899
- } = _ref3;
1051
+ } = _ref6;
900
1052
  const {
901
1053
  is2D,
902
1054
  totalWidth,
@@ -1152,6 +1304,15 @@ function DoorModels(_ref3) {
1152
1304
  const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
1153
1305
  const topArchitraveWidth = doorWidthM + 2 * architraveProfileM;
1154
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
+
1155
1316
  // --- Primary Gasket Edge Position Calculations ---
1156
1317
  const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
1157
1318
  const leftGasketXPosition = -doorWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
@@ -1615,6 +1776,12 @@ function DoorModels(_ref3) {
1615
1776
  children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1616
1777
  args: [occulusWidthM, occulusHeightM, occulusInfillDepthM]
1617
1778
  })
1779
+ }), /*#__PURE__*/jsxRuntime.jsx(DoorHandle, {
1780
+ bodyType: bodyType,
1781
+ handleX: handleX,
1782
+ handleHeightM: handleHeightM,
1783
+ doorDepthM: doorDepthM,
1784
+ doorPivot: doorPivot
1618
1785
  })]
1619
1786
  })]
1620
1787
  }), isPlaneVisible && /*#__PURE__*/jsxRuntime.jsxs("mesh", {