door_models 3.0.9 → 4.0.1
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 +26 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -9
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, createContext, useState,
|
|
1
|
+
import { useContext, createContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { Geometry, Base, Subtraction } from '@react-three/csg';
|
|
4
4
|
import { useSpring, a } from '@react-spring/three';
|
|
@@ -72,8 +72,10 @@ const _excluded = ["doorDepth"];
|
|
|
72
72
|
const ConfiguratorContext = /*#__PURE__*/createContext(undefined);
|
|
73
73
|
const ConfiguratorProvider = _ref => {
|
|
74
74
|
let {
|
|
75
|
-
children
|
|
75
|
+
children,
|
|
76
|
+
initialIs2D = false
|
|
76
77
|
} = _ref;
|
|
78
|
+
const [is2D, setIs2D] = useState(initialIs2D);
|
|
77
79
|
const [isPlaneVisible, setIsPlaneVisible] = useState(false);
|
|
78
80
|
const [isFrameVisible, setIsFrameVisible] = useState(true);
|
|
79
81
|
const [cpid, setCpid] = useState("");
|
|
@@ -170,6 +172,9 @@ const ConfiguratorProvider = _ref => {
|
|
|
170
172
|
type: "",
|
|
171
173
|
text: ""
|
|
172
174
|
});
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
setIs2D(initialIs2D);
|
|
177
|
+
}, [initialIs2D]);
|
|
173
178
|
const handleParseCpid = useCallback(cpidToParse => {
|
|
174
179
|
const showMessage = function (text) {
|
|
175
180
|
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
|
|
@@ -606,6 +611,8 @@ const ConfiguratorProvider = _ref => {
|
|
|
606
611
|
}, [totalWidth, doorFrame.sidesThk]);
|
|
607
612
|
return /*#__PURE__*/jsx(ConfiguratorContext.Provider, {
|
|
608
613
|
value: {
|
|
614
|
+
is2D,
|
|
615
|
+
setIs2D,
|
|
609
616
|
isPlaneVisible,
|
|
610
617
|
setIsPlaneVisible,
|
|
611
618
|
isFrameVisible,
|
|
@@ -867,6 +874,9 @@ function DoorModels(_ref3) {
|
|
|
867
874
|
doorName
|
|
868
875
|
} = _ref3;
|
|
869
876
|
const {
|
|
877
|
+
is2D,
|
|
878
|
+
totalWidth,
|
|
879
|
+
totalHeight,
|
|
870
880
|
isPlaneVisible,
|
|
871
881
|
isFrameVisible,
|
|
872
882
|
door,
|
|
@@ -1171,6 +1181,18 @@ function DoorModels(_ref3) {
|
|
|
1171
1181
|
}
|
|
1172
1182
|
return true;
|
|
1173
1183
|
}, [isFrameVisible, frameType, isGlassDoor]);
|
|
1184
|
+
if (is2D) {
|
|
1185
|
+
return /*#__PURE__*/jsx("group", {
|
|
1186
|
+
children: /*#__PURE__*/jsxs("mesh", {
|
|
1187
|
+
children: [/*#__PURE__*/jsx("boxGeometry", {
|
|
1188
|
+
args: [totalWidth / 1000, 0.1, frameDepth / 1000]
|
|
1189
|
+
}), /*#__PURE__*/jsx("meshBasicMaterial", {
|
|
1190
|
+
color: "white",
|
|
1191
|
+
side: THREE.DoubleSide
|
|
1192
|
+
})]
|
|
1193
|
+
})
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1174
1196
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
1175
1197
|
children: [frontCoverPanel.visible && /*#__PURE__*/jsxs("group", {
|
|
1176
1198
|
"position-z": frontArchitraveZ,
|
|
@@ -1588,9 +1610,11 @@ function DoorModels(_ref3) {
|
|
|
1588
1610
|
const DoorConfigurator = _ref => {
|
|
1589
1611
|
let {
|
|
1590
1612
|
doorName,
|
|
1591
|
-
showInterface = true
|
|
1613
|
+
showInterface = true,
|
|
1614
|
+
is2D = false
|
|
1592
1615
|
} = _ref;
|
|
1593
1616
|
return /*#__PURE__*/jsx(ConfiguratorProvider, {
|
|
1617
|
+
initialIs2D: is2D,
|
|
1594
1618
|
children: /*#__PURE__*/jsx(DoorModels, {
|
|
1595
1619
|
doorName: doorName
|
|
1596
1620
|
})
|