door_models 5.4.6 → 5.4.8

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 DELETED
@@ -1,2392 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var csg = require('@react-three/csg');
8
- var three = require('@react-spring/three');
9
- var THREE = require('three');
10
- var drei = require('@react-three/drei');
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n["default"] = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
33
- var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
34
-
35
- function _defineProperty(e, r, t) {
36
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
37
- value: t,
38
- enumerable: !0,
39
- configurable: !0,
40
- writable: !0
41
- }) : e[r] = t, e;
42
- }
43
- function ownKeys(e, r) {
44
- var t = Object.keys(e);
45
- if (Object.getOwnPropertySymbols) {
46
- var o = Object.getOwnPropertySymbols(e);
47
- r && (o = o.filter(function (r) {
48
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
49
- })), t.push.apply(t, o);
50
- }
51
- return t;
52
- }
53
- function _objectSpread2(e) {
54
- for (var r = 1; r < arguments.length; r++) {
55
- var t = null != arguments[r] ? arguments[r] : {};
56
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
57
- _defineProperty(e, r, t[r]);
58
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
59
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
60
- });
61
- }
62
- return e;
63
- }
64
- function _objectWithoutProperties(e, t) {
65
- if (null == e) return {};
66
- var o,
67
- r,
68
- i = _objectWithoutPropertiesLoose(e, t);
69
- if (Object.getOwnPropertySymbols) {
70
- var n = Object.getOwnPropertySymbols(e);
71
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
72
- }
73
- return i;
74
- }
75
- function _objectWithoutPropertiesLoose(r, e) {
76
- if (null == r) return {};
77
- var t = {};
78
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
79
- if (-1 !== e.indexOf(n)) continue;
80
- t[n] = r[n];
81
- }
82
- return t;
83
- }
84
- function _toPrimitive(t, r) {
85
- if ("object" != typeof t || !t) return t;
86
- var e = t[Symbol.toPrimitive];
87
- if (void 0 !== e) {
88
- var i = e.call(t, r || "default");
89
- if ("object" != typeof i) return i;
90
- throw new TypeError("@@toPrimitive must return a primitive value.");
91
- }
92
- return ("string" === r ? String : Number)(t);
93
- }
94
- function _toPropertyKey(t) {
95
- var i = _toPrimitive(t, "string");
96
- return "symbol" == typeof i ? i : i + "";
97
- }
98
-
99
- const _excluded = ["doorDepth"];
100
- const ConfiguratorContext = /*#__PURE__*/React.createContext(undefined);
101
- const ConfiguratorProvider = _ref => {
102
- let {
103
- children,
104
- initialIs2D = false,
105
- initialMaterials = {},
106
- totalWidth: widthProp,
107
- totalHeight: heightProp,
108
- totalDepth: depthProp
109
- } = _ref;
110
- const [materials, setMaterials] = React.useState(initialMaterials);
111
- const [is2D, setIs2D] = React.useState(initialIs2D);
112
- const [isPlaneVisible, setIsPlaneVisible] = React.useState(false);
113
- const [isFrameVisible, setIsFrameVisible] = React.useState(true);
114
- const [cpid, setCpid] = React.useState("");
115
- const [totalHeight, setTotalHeight] = React.useState(2700);
116
- const [totalWidth, setTotalWidth] = React.useState(974);
117
- const [totalDepth, setTotalDepth] = React.useState(103);
118
- const [glassVisible, setGlassVisible] = React.useState(false);
119
- const [glassDepth, setGlassDepth] = React.useState(8);
120
- const [isDoubleDoor, setIsDoubleDoor] = React.useState(false);
121
- const [door, setDoor] = React.useState({
122
- doorMaterial: "door_material",
123
- doorWidth: 0,
124
- doorHeight: 0,
125
- theDoorDepth: 40,
126
- doorPivot: "left",
127
- doorOpening: "out"
128
- });
129
- const [doorFrame, setDoorFrame] = React.useState({
130
- frameMaterial: "doorFrame_material",
131
- doorStopMaterial: "doorStop_material",
132
- gasketMaterial: "gasket_material",
133
- hingeMaterial: "hinge_material",
134
- glassMaterial: "glass_material",
135
- frameDepth: 103,
136
- topThk: "20mm",
137
- sidesThk: "20mm",
138
- doorStopOffset: "30mm",
139
- doorStopWidth: 20,
140
- doorStopDepth: 13,
141
- notchWidth: "20mm",
142
- notchDepth: "40mm",
143
- notchposition: 0.01,
144
- gasketDepth: 5,
145
- gasketWidth: 5,
146
- secondDoorStopWidth: 20,
147
- secondDoorStopDepth: 30,
148
- secondDoorStopOffset: 13
149
- });
150
- const [interiorFanlight, setInteriorFanlight] = React.useState({
151
- visible: false,
152
- height: 300,
153
- material: "interiorFanlight_material"
154
- });
155
- const [exteriorFanlight, setExteriorFanlight] = React.useState({
156
- visible: false,
157
- height: 300,
158
- depth: 60,
159
- material: "exteriorFanlight_material"
160
- });
161
- const [occulus, setOcculus] = React.useState({
162
- visible: false,
163
- infillVisible: true,
164
- x1: 150,
165
- x2: 150,
166
- y1: 150,
167
- y2: 150,
168
- material: "infill_material",
169
- depth: 20
170
- });
171
- const [frontCoverPanel, setFrontCoverPanel] = React.useState({
172
- visible: false,
173
- width: 73,
174
- height: 2200,
175
- depth: 12,
176
- material: "front_cover_material"
177
- });
178
- const [backCoverPanel, setBackCoverPanel] = React.useState({
179
- visible: false,
180
- width: 73,
181
- height: 2200,
182
- depth: 12,
183
- material: "back_cover_material"
184
- });
185
- const [frontDoorPlane, setFrontDoorPlane] = React.useState({
186
- visible: true,
187
- material: "frontDoor_material"
188
- });
189
- const [backDoorPlane, setBackDoorPlane] = React.useState({
190
- visible: true,
191
- material: "frontDoor_material"
192
- });
193
- const [glass, setGlass] = React.useState({
194
- visible: false,
195
- material: "infill_material",
196
- depth: 20
197
- });
198
- const [baseConfig, setBaseConfig] = React.useState(null);
199
- const [frameType, setFrameType] = React.useState("AF20_40");
200
- const [bodyType, setBodyType] = React.useState("40");
201
- const [exteriorFanlightType, setExteriorFanlightType] = React.useState("WPFL");
202
- const doorHeight = 0;
203
- const [newPivotPosition, setNewPivotPosition] = React.useState(0);
204
- const [parseMessage, setParseMessage] = React.useState({
205
- type: "",
206
- text: ""
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]);
223
- React.useEffect(() => {
224
- setIs2D(initialIs2D);
225
- }, [initialIs2D]);
226
- React.useEffect(() => {
227
- if (initialMaterials) {
228
- setMaterials(initialMaterials);
229
- }
230
- }, [initialMaterials]);
231
- const handleParseCpid = React.useCallback(cpidToParse => {
232
- const showMessage = function (text) {
233
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
234
- setParseMessage({
235
- text,
236
- type
237
- });
238
- setTimeout(() => setParseMessage({
239
- text: "",
240
- type: ""
241
- }), 4000);
242
- };
243
- if (!cpidToParse || !cpidToParse.trim().startsWith("P_")) {
244
- showMessage("Invalid format: CPID must start with 'P_'.");
245
- return;
246
- }
247
- const parts = cpidToParse.trim().split("_");
248
- if (parts.length < 4) {
249
- showMessage("Invalid format: Not enough parts in CPID.");
250
- return;
251
- }
252
- const newConfig = {
253
- fanlightVisible: false,
254
- fanlightType: "WPFL",
255
- interiorFanlightVisible: false,
256
- occulusVisible: false,
257
- frameType: "",
258
- bodyType: ""
259
- };
260
- let currentIndex = 1;
261
-
262
- // Door Type
263
- if (parts[currentIndex] === "SD") {
264
- setIsDoubleDoor(false);
265
- setTotalHeight(2700);
266
- setTotalWidth(974);
267
- currentIndex++;
268
- } else if (parts[currentIndex] === "DD") {
269
- setIsDoubleDoor(true);
270
- setTotalWidth(1802);
271
- currentIndex++;
272
- } else {
273
- showMessage("Unsupported Door Type: Only 'SD' or 'DD' is supported.");
274
- return;
275
- }
276
-
277
- //Fanlight Type
278
- const fanlightPart = parts[currentIndex];
279
- const validFanlights = ["WPFL", "ALDGFL", "ALSGFL"];
280
- if (fanlightPart === "FH") {
281
- newConfig.fanlightVisible = false;
282
- currentIndex++;
283
- } else if (validFanlights.includes(fanlightPart)) {
284
- setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
285
- height: 300
286
- }));
287
- newConfig.fanlightVisible = true;
288
- newConfig.fanlightType = fanlightPart;
289
- currentIndex++;
290
- } else {
291
- showMessage("Invalid Fanlight Type: '".concat(fanlightPart, "'."));
292
- return;
293
- }
294
-
295
- // Frame and Body Type
296
- const validSimpleFrameTypes = ["AF20", "AF40", "WF", "MXF", "MXCAF", "NOF"];
297
- const validBodyTypes = ["40", "50", "FLI", "100", "WDG100", "SG8", "SG10", "SG12"];
298
- let framePart = parts[currentIndex];
299
- let bodyPartRaw = parts[currentIndex + 1] || "";
300
- let frameFound = false;
301
- if ("".concat(framePart, "_").concat(bodyPartRaw) === "WDGF_WDG100") {
302
- newConfig.frameType = "WDGF_WDG100";
303
- newConfig.bodyType = "WDG100";
304
- currentIndex += 2;
305
- frameFound = true;
306
- } else if (validSimpleFrameTypes.includes(framePart)) {
307
- let tempBody = bodyPartRaw.replace("OCC", "");
308
- if (validBodyTypes.includes(tempBody)) {
309
- newConfig.frameType = framePart === "NOF" ? "NOF" : "".concat(framePart, "_").concat(tempBody);
310
- newConfig.bodyType = tempBody;
311
- if (bodyPartRaw.endsWith("OCC")) {
312
- newConfig.occulusVisible = true;
313
- setOcculus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
314
- x1: 150,
315
- x2: 150,
316
- y1: 150,
317
- y2: 150
318
- }));
319
- }
320
- currentIndex += 2;
321
- frameFound = true;
322
- }
323
- }
324
- if (!frameFound) {
325
- showMessage("Invalid Frame/Body combination starting with '".concat(framePart, "'."));
326
- return;
327
- }
328
- for (let i = currentIndex; i < parts.length; i++) {
329
- if (parts[i] === "IFL") {
330
- setInteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
331
- height: 300
332
- }));
333
- newConfig.interiorFanlightVisible = true;
334
- } else if (parts[i] === "OCC") {
335
- newConfig.occulusVisible = true;
336
- }
337
- }
338
-
339
- // Apply final configuration
340
- setFrameType(newConfig.frameType);
341
- setBodyType(newConfig.bodyType);
342
- setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
343
- visible: newConfig.fanlightVisible
344
- }));
345
- if (newConfig.fanlightVisible) {
346
- setExteriorFanlightType(newConfig.fanlightType);
347
- }
348
- setInteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
349
- visible: newConfig.interiorFanlightVisible
350
- }));
351
- setOcculus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
352
- visible: newConfig.occulusVisible
353
- }));
354
- setCpid(cpidToParse);
355
- showMessage("Configuration Applied!", "success");
356
- }, [setCpid, setBodyType, setExteriorFanlight, setExteriorFanlightType, setFrameType, setInteriorFanlight, setOcculus, setIsDoubleDoor, setTotalWidth]);
357
-
358
- // --- BodyType Effect ---
359
- React.useEffect(() => {
360
- let newDoorDepth = 40;
361
- switch (bodyType) {
362
- case "50":
363
- newDoorDepth = 50;
364
- break;
365
- case "SG8":
366
- newDoorDepth = 8;
367
- break;
368
- case "SG10":
369
- newDoorDepth = 10;
370
- break;
371
- case "SG12":
372
- newDoorDepth = 12;
373
- break;
374
- }
375
- setDoor(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
376
- theDoorDepth: newDoorDepth
377
- }));
378
- }, [bodyType]);
379
-
380
- // --- FrameType Effect ---
381
- React.useEffect(() => {
382
- setIsFrameVisible(frameType !== "NOF");
383
- setGlassVisible(false);
384
- let newSettings = {};
385
- let lookupKey = frameType;
386
- if (frameType.startsWith("AF20_SG")) {
387
- lookupKey = "AF20_40";
388
- } else if (frameType.startsWith("AF40_SG")) {
389
- lookupKey = "AF40_40";
390
- }
391
- switch (lookupKey) {
392
- case "NOF":
393
- newSettings = {
394
- topThk: "0mm",
395
- sidesThk: "0mm",
396
- frameDepth: 0
397
- };
398
- break;
399
- case "AF20_40":
400
- newSettings = {
401
- frameDepth: 103,
402
- topThk: "20mm",
403
- sidesThk: "20mm",
404
- doorStopOffset: "42mm",
405
- doorStopWidth: 20,
406
- doorStopDepth: 13,
407
- notchWidth: "20mm",
408
- notchDepth: "40mm",
409
- notchposition: 0.01,
410
- gasketDepth: 5,
411
- gasketWidth: 5
412
- };
413
- if (frameType === "AF20_40") {
414
- newSettings.doorDepth = 40;
415
- }
416
- break;
417
- case "AF20_50":
418
- newSettings = {
419
- doorDepth: 50,
420
- frameDepth: 103,
421
- topThk: "20mm",
422
- sidesThk: "20mm",
423
- doorStopOffset: "30mm",
424
- doorStopWidth: 20,
425
- doorStopDepth: 13,
426
- notchWidth: "20mm",
427
- notchDepth: "40mm",
428
- notchposition: 0.01,
429
- gasketDepth: 5,
430
- gasketWidth: 5
431
- };
432
- break;
433
- case "AF40_40":
434
- newSettings = {
435
- frameDepth: 103,
436
- topThk: "40mm",
437
- sidesThk: "40mm",
438
- doorStopOffset: "42mm",
439
- doorStopWidth: 20,
440
- doorStopDepth: 13,
441
- notchWidth: "20mm",
442
- notchDepth: "40mm",
443
- notchposition: 0.01,
444
- gasketDepth: 5,
445
- gasketWidth: 5
446
- };
447
- if (frameType === "AF40_40") {
448
- newSettings.doorDepth = 40;
449
- }
450
- break;
451
- case "AF40_50":
452
- newSettings = {
453
- doorDepth: 50,
454
- frameDepth: 103,
455
- topThk: "40mm",
456
- sidesThk: "40mm",
457
- doorStopOffset: "30mm",
458
- doorStopWidth: 20,
459
- doorStopDepth: 13,
460
- notchWidth: "20mm",
461
- notchDepth: "40mm",
462
- notchposition: 0.01,
463
- gasketDepth: 5,
464
- gasketWidth: 5
465
- };
466
- break;
467
- case "WF_40":
468
- newSettings = {
469
- doorDepth: 39.6,
470
- frameDepth: 103,
471
- topThk: "31.6mm",
472
- sidesThk: "31.6mm",
473
- doorStopOffset: "0mm",
474
- doorStopWidth: 16.4,
475
- doorStopDepth: 58.4,
476
- notchWidth: "20mm",
477
- notchDepth: "40mm",
478
- notchposition: 0.01,
479
- gasketDepth: 5,
480
- gasketWidth: 5
481
- };
482
- break;
483
- case "WF_50":
484
- newSettings = {
485
- doorDepth: 51.6,
486
- frameDepth: 103,
487
- topThk: "31.6mm",
488
- sidesThk: "31.6mm",
489
- doorStopOffset: "0mm",
490
- doorStopWidth: 16,
491
- doorStopDepth: 46.4,
492
- notchWidth: "20mm",
493
- notchDepth: "40mm",
494
- notchposition: 0.01,
495
- gasketDepth: 5,
496
- gasketWidth: 5
497
- };
498
- break;
499
- case "WF_100":
500
- newSettings = {
501
- doorDepth: 102,
502
- frameDepth: 102,
503
- topThk: "52mm",
504
- sidesThk: "52mm",
505
- doorStopOffset: "17.6mm",
506
- doorStopWidth: 16.4,
507
- doorStopDepth: 44.8,
508
- notchWidth: "16mm",
509
- notchDepth: "66.5mm",
510
- notchposition: 0.02,
511
- gasketDepth: 5,
512
- gasketWidth: 5,
513
- secondDoorStopWidth: 29,
514
- secondDoorStopDepth: 17.6,
515
- secondDoorStopOffset: 0
516
- };
517
- break;
518
- case "WF_FLI":
519
- newSettings = {
520
- doorDepth: 51,
521
- frameDepth: 102,
522
- topThk: "52mm",
523
- sidesThk: "52mm",
524
- doorStopOffset: "17.4mm",
525
- doorStopWidth: 16.4,
526
- doorStopDepth: 34,
527
- notchWidth: "14mm",
528
- notchDepth: "66mm",
529
- notchposition: 0.02,
530
- gasketDepth: 5,
531
- gasketWidth: 5,
532
- secondDoorStopWidth: 29,
533
- secondDoorStopDepth: 17.6,
534
- secondDoorStopOffset: 0
535
- };
536
- break;
537
- case "WDGF_WDG100":
538
- newSettings = {
539
- doorDepth: 86,
540
- frameDepth: 86,
541
- topThk: "50mm",
542
- sidesThk: "50mm",
543
- doorStopOffset: "34mm",
544
- doorStopWidth: 13,
545
- doorStopDepth: 30,
546
- notchWidth: "14mm",
547
- notchDepth: "66mm",
548
- notchposition: 0.02,
549
- gasketDepth: 4.5,
550
- gasketWidth: 5,
551
- secondDoorStopWidth: 23,
552
- secondDoorStopDepth: 30,
553
- secondDoorStopOffset: 13
554
- };
555
- setGlassVisible(true);
556
- break;
557
- case "MXF_40":
558
- newSettings = {
559
- doorDepth: 38,
560
- frameDepth: 103,
561
- topThk: "18mm",
562
- sidesThk: "18mm",
563
- doorStopOffset: "45mm",
564
- doorStopWidth: 15,
565
- doorStopDepth: 15,
566
- notchWidth: "20mm",
567
- notchDepth: "40mm",
568
- notchposition: 0.01,
569
- gasketDepth: 5,
570
- gasketWidth: 5
571
- };
572
- break;
573
- case "MXF_50":
574
- newSettings = {
575
- doorDepth: 50,
576
- frameDepth: 103,
577
- topThk: "18.2mm",
578
- sidesThk: "18.2mm",
579
- doorStopOffset: "33mm",
580
- doorStopWidth: 15,
581
- doorStopDepth: 15,
582
- notchWidth: "20mm",
583
- notchDepth: "40mm",
584
- notchposition: 0.01,
585
- gasketDepth: 5,
586
- gasketWidth: 5
587
- };
588
- break;
589
- case "MXCAF_40":
590
- newSettings = {
591
- doorDepth: 38,
592
- frameDepth: 103,
593
- topThk: "18mm",
594
- sidesThk: "18mm",
595
- doorStopOffset: "45mm",
596
- doorStopWidth: 15,
597
- doorStopDepth: 15,
598
- notchWidth: "20mm",
599
- notchDepth: "40mm",
600
- notchposition: 0.01,
601
- gasketDepth: 5,
602
- gasketWidth: 5
603
- };
604
- break;
605
- case "MXCAF_50":
606
- newSettings = {
607
- doorDepth: 50,
608
- frameDepth: 103,
609
- topThk: "18.2mm",
610
- sidesThk: "18.2mm",
611
- doorStopOffset: "33mm",
612
- doorStopWidth: 15,
613
- doorStopDepth: 15,
614
- notchWidth: "20mm",
615
- notchDepth: "40mm",
616
- notchposition: 0.01,
617
- gasketDepth: 5,
618
- gasketWidth: 5
619
- };
620
- break;
621
- }
622
-
623
- // Store pristine settings for scaling
624
- setBaseConfig(newSettings);
625
- const isMxCaf = frameType.startsWith("MXCAF");
626
- setFrontCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
627
- visible: isMxCaf
628
- }));
629
- setBackCoverPanel(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
630
- visible: isMxCaf
631
- }));
632
- const {
633
- doorDepth
634
- } = newSettings,
635
- newFrameSettings = _objectWithoutProperties(newSettings, _excluded);
636
- setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), newFrameSettings));
637
- if (doorDepth !== undefined) {
638
- setDoor(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
639
- theDoorDepth: doorDepth
640
- }));
641
- }
642
-
643
- // Sync totalDepth with the frame's default depth when frame type changes.
644
- if (newSettings.frameDepth) {
645
- setTotalDepth(newSettings.frameDepth);
646
- }
647
- }, [frameType]);
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
-
701
- // --- Exterior Fanlight Logic ---
702
- React.useEffect(() => {
703
- if (!exteriorFanlight.visible) return;
704
- switch (exteriorFanlightType) {
705
- case "WPFL":
706
- setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
707
- depth: doorFrame.frameDepth
708
- }));
709
- break;
710
- case "ALDGFL":
711
- setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
712
- depth: doorFrame.frameDepth
713
- }));
714
- break;
715
- case "ALSGFL":
716
- setExteriorFanlight(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
717
- depth: 40
718
- }));
719
- break;
720
- }
721
- }, [exteriorFanlight.visible, exteriorFanlightType, doorFrame.frameDepth, setExteriorFanlight]);
722
- React.useEffect(() => {
723
- setOcculus(prevOcculus => _objectSpread2(_objectSpread2({}, prevOcculus), {}, {
724
- depth: door.theDoorDepth
725
- }));
726
- }, [door.theDoorDepth]);
727
- React.useEffect(() => {
728
- const topThkValue = parseInt(doorFrame.topThk) || 0;
729
- const exteriorFanlightHeight = exteriorFanlight.visible ? exteriorFanlight.height : 0;
730
- const newDoorHeight = totalHeight - topThkValue - exteriorFanlightHeight;
731
- setDoor(prevDoor => _objectSpread2(_objectSpread2({}, prevDoor), {}, {
732
- doorHeight: newDoorHeight > 0 ? newDoorHeight : 0
733
- }));
734
- }, [totalHeight, doorFrame.topThk, exteriorFanlight.visible, exteriorFanlight.height]);
735
- React.useEffect(() => {
736
- const sidesThkValue = parseInt(doorFrame.sidesThk) || 0;
737
- const numDoors = isDoubleDoor ? 2 : 1;
738
- const newDoorWidth = (totalWidth - sidesThkValue * 2) / numDoors;
739
- setDoor(prevDoor => _objectSpread2(_objectSpread2({}, prevDoor), {}, {
740
- doorWidth: newDoorWidth > 0 ? newDoorWidth : 0
741
- }));
742
- }, [totalWidth, doorFrame.sidesThk, isDoubleDoor]);
743
- return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorContext.Provider, {
744
- value: {
745
- materials,
746
- setMaterials,
747
- is2D,
748
- setIs2D,
749
- isPlaneVisible,
750
- setIsPlaneVisible,
751
- isFrameVisible,
752
- setIsFrameVisible,
753
- cpid,
754
- setCpid,
755
- door,
756
- setDoor,
757
- doorFrame,
758
- setDoorFrame,
759
- interiorFanlight,
760
- setInteriorFanlight,
761
- exteriorFanlight,
762
- setExteriorFanlight,
763
- occulus,
764
- setOcculus,
765
- frontCoverPanel,
766
- setFrontCoverPanel,
767
- backCoverPanel,
768
- setBackCoverPanel,
769
- frontDoorPlane,
770
- setFrontDoorPlane,
771
- backDoorPlane,
772
- setBackDoorPlane,
773
- glass,
774
- setGlass,
775
- frameType,
776
- setFrameType,
777
- bodyType,
778
- setBodyType,
779
- totalHeight,
780
- setTotalHeight,
781
- totalDepth,
782
- setTotalDepth,
783
- totalWidth,
784
- setTotalWidth,
785
- exteriorFanlightType,
786
- setExteriorFanlightType,
787
- glassVisible,
788
- setGlassVisible,
789
- glassDepth,
790
- setGlassDepth,
791
- handleParseCpid,
792
- newPivotPosition,
793
- setNewPivotPosition,
794
- doorHeight,
795
- isDoubleDoor,
796
- setIsDoubleDoor
797
- },
798
- children: children
799
- });
800
- };
801
- const useConfigurator = () => {
802
- const context = React.useContext(ConfiguratorContext);
803
- if (!context) {
804
- throw new Error("useConfigurator must be used within a ConfiguratorProvider");
805
- }
806
- return context;
807
- };
808
-
809
- const availableMaterials = {
810
- black: new THREE__namespace.MeshStandardMaterial({
811
- color: "#000000"
812
- }),
813
- metal: new THREE__namespace.MeshStandardMaterial({
814
- color: "#aaaaaa",
815
- metalness: 1.0,
816
- roughness: 0.4
817
- }),
818
- darkgrey: new THREE__namespace.MeshStandardMaterial({
819
- color: "#5e5e5e"
820
- }),
821
- grey: new THREE__namespace.MeshStandardMaterial({
822
- color: "#cccccc"
823
- }),
824
- yellow: new THREE__namespace.MeshStandardMaterial({
825
- color: "#ffff00"
826
- }),
827
- darkBrown: new THREE__namespace.MeshStandardMaterial({
828
- color: "#a0522d"
829
- }),
830
- brown: new THREE__namespace.MeshStandardMaterial({
831
- color: "#d2b48c"
832
- }),
833
- glass: new THREE__namespace.MeshStandardMaterial({
834
- color: "#ffffff",
835
- roughness: 0.1,
836
- transparent: true,
837
- opacity: 0.7
838
- }),
839
- aluminum: new THREE__namespace.MeshStandardMaterial({
840
- color: "#abb0aa",
841
- metalness: 0.8,
842
- roughness: 0.5,
843
- envMapIntensity: 1.2
844
- }),
845
- aluminumBrighter: new THREE__namespace.MeshStandardMaterial({
846
- color: "#cdcdcd",
847
- metalness: 0.8,
848
- roughness: 0.5,
849
- envMapIntensity: 1.2
850
- }),
851
- aluminumExtraBrighter: new THREE__namespace.MeshStandardMaterial({
852
- color: "#ececec",
853
- metalness: 0.8,
854
- roughness: 0.5,
855
- envMapIntensity: 1.2
856
- }),
857
- silver: new THREE__namespace.MeshStandardMaterial({
858
- color: "#c0c0c0",
859
- metalness: 1.0,
860
- roughness: 0.2
861
- }),
862
- gold: new THREE__namespace.MeshStandardMaterial({
863
- color: "#ffd700",
864
- metalness: 1.0,
865
- roughness: 0.3
866
- }),
867
- diamond: new THREE__namespace.MeshStandardMaterial({
868
- color: "#e0f7fa",
869
- metalness: 0.9,
870
- roughness: 0.05,
871
- transparent: true,
872
- opacity: 0.9,
873
- envMapIntensity: 1.5
874
- }),
875
- test_material: new THREE__namespace.MeshStandardMaterial({
876
- color: "red",
877
- roughness: 0.1
878
- })
879
- };
880
- new THREE__namespace.MeshStandardMaterial({
881
- color: "#cccccc",
882
- roughness: 0.8
883
- });
884
- new THREE__namespace.MeshStandardMaterial({
885
- color: "#000",
886
- roughness: 0.8
887
- });
888
-
889
- // Helper function to check for hex color codes
890
- const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
891
-
892
- /**
893
- * A simple "builder" that creates a THREE.MeshStandardMaterial from a prop and an
894
- * optional map of pre-loaded textures. It now loads textures if they are not pre-loaded.
895
- * @param prop - The material definition (string or object).
896
- * @param textures - A map of URL -> THREE.Texture, provided by useTexture.
897
- * @returns A THREE.MeshStandardMaterial instance.
898
- */
899
- const buildMaterial = (prop, textures) => {
900
- if (!prop) {
901
- return new THREE__namespace.MeshStandardMaterial({
902
- color: "#cccccc",
903
- roughness: 0.8
904
- });
905
- }
906
- const sourceValue = typeof prop === "string" ? prop : prop.value;
907
- const opacity = typeof prop === "object" ? prop.opacity : 1;
908
-
909
- // Start with base parameters.
910
- const params = {
911
- roughness: 0.8,
912
- side: THREE__namespace.DoubleSide
913
- };
914
- if (isHexColor(sourceValue)) {
915
- // It's a color. Explicitly set the color and ensure no texture is applied.
916
- params.color = sourceValue;
917
- params.map = null;
918
- } else {
919
- // It's a texture. Explicitly set the color to white to avoid tinting the texture.
920
- params.color = "#ffffff";
921
- let texture = null;
922
- if (textures && textures[sourceValue]) {
923
- // Use the pre-loaded texture.
924
- texture = textures[sourceValue];
925
- } else if (sourceValue) {
926
- // Not pre-loaded, so load it now.
927
- // TextureLoader caches results internally, so this is efficient.
928
- texture = new THREE__namespace.TextureLoader().load(sourceValue);
929
- }
930
- params.map = texture;
931
- }
932
-
933
- // Handle transparency explicitly to prevent lingering state.
934
- if (opacity !== undefined && opacity < 1) {
935
- params.transparent = true;
936
- params.opacity = opacity;
937
- } else {
938
- // Explicitly turn transparency off if opacity is 1 or undefined.
939
- params.transparent = false;
940
- params.opacity = 1;
941
- }
942
- return new THREE__namespace.MeshStandardMaterial(params);
943
- };
944
- const getFirstValidValue = values => {
945
- for (const val of values) {
946
- if (val) {
947
- return val;
948
- }
949
- }
950
- return undefined;
951
- };
952
-
953
- // Re-export the type for easy access in other components
954
-
955
- const useDoorMaterials = function () {
956
- let materialsProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
957
- // 1. Collect all unique texture URLs from the props.
958
- const textureUrls = React.useMemo(() => {
959
- const urls = new Set();
960
- // Iterate over all passed material props
961
- Object.values(materialsProp).forEach(prop => {
962
- // Get the value, whether it's a string or inside an object
963
- const value = typeof prop === "string" ? prop : prop === null || prop === void 0 ? void 0 : prop.value;
964
- // If it's a valid URL, add it to our set to avoid duplicates
965
- if (value && (value.startsWith("http") || value.startsWith("/"))) {
966
- urls.add(value);
967
- }
968
- });
969
- return Array.from(urls);
970
- }, [materialsProp]);
971
-
972
- // 2. Load all textures at once.
973
- // !! THIS IS THE MAGIC !!
974
- // `useTexture` will pause ("suspend") this component's rendering
975
- // until all textures in the array are fully loaded.
976
- const loadedTextures = drei.useTexture(textureUrls);
977
-
978
- // 3. Create a map from URL back to the loaded THREE.Texture for easy lookup.
979
- const textureMap = React.useMemo(() => {
980
- const map = {};
981
- textureUrls.forEach((url, index) => {
982
- map[url] = loadedTextures[index];
983
- });
984
- return map;
985
- }, [textureUrls, loadedTextures]);
986
-
987
- // 4. Now that textures are guaranteed to be loaded, build all materials.
988
- // This memo ensures the materials are only created when props or textures change.
989
- return React.useMemo(() => {
990
- const build = prop => buildMaterial(prop, textureMap);
991
- return {
992
- doorMaterial: build(materialsProp.Body),
993
- frameMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),
994
- gasketMaterial: build(materialsProp.D_GASKET),
995
- doorStopMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),
996
- interiorFanlightMaterial: build(materialsProp.D_SRF_DECOR),
997
- exteriorFanlightMaterial: build(materialsProp.D_SRF_DECOR),
998
- occulusInfillMaterial: build(materialsProp.D_FR_COLOR),
999
- glassInfillMaterial: build(materialsProp.D_FR_COLOR),
1000
- frontCoverPanelMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),
1001
- backCoverPanelMaterial: build(getFirstValidValue([materialsProp.D_PRF_COLOR, materialsProp.D_FR_SRF_DECOR, materialsProp.D_FR_SRF_DECOR_S2])),
1002
- frontDoorPlaneMaterial: build(materialsProp.D_SRF_DECOR_2),
1003
- backDoorPlaneMaterial: build(materialsProp.D_SRF_DECOR),
1004
- hingeBodyMaterial: build(materialsProp.Hinge),
1005
- hingeAccentMaterial: build(materialsProp.HingeCuts)
1006
- };
1007
- }, [materialsProp, textureMap]);
1008
- };
1009
-
1010
- function StandardHandle(_ref) {
1011
- let {
1012
- position,
1013
- doorDepthM,
1014
- doorPivot,
1015
- frameType
1016
- } = _ref;
1017
- // --- Base Dimensions ---
1018
- const roseRadius = 0.035;
1019
-
1020
- // --- Thickness ---
1021
- // default 5mm, but 8mm + 1–2mm if WDG frame
1022
- const roseThickness = frameType === "WDGF_WDG100" ? 0.008 + 0.0015 : 0.005;
1023
- const handleRadius = 0.015;
1024
- const handleLength = 0.2;
1025
-
1026
- // face offset based on thickness
1027
- const faceZ = doorDepthM / 2 + roseThickness / 2;
1028
- const connectorLength = handleLength / 3;
1029
- const cornerFrontZ = faceZ + roseThickness + connectorLength;
1030
- const cornerBackZ = -faceZ - roseThickness - connectorLength;
1031
- const roseGapY = 0.07;
1032
- return /*#__PURE__*/jsxRuntime.jsxs("group", {
1033
- position: position,
1034
- children: [[faceZ, -faceZ].map((z, i) => /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
1035
- children: [frameType === "WDGF_WDG100" ?
1036
- /*#__PURE__*/
1037
- // --- Capsule rose ---
1038
- jsxRuntime.jsxs("group", {
1039
- "position-z": z,
1040
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1041
- material: availableMaterials.aluminum,
1042
- castShadow: true,
1043
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1044
- args: [roseRadius * 2, roseRadius * 2, roseThickness]
1045
- })
1046
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1047
- "position-y": roseRadius,
1048
- rotation: [Math.PI / 2, Math.PI / 2, 0],
1049
- material: availableMaterials.aluminum,
1050
- castShadow: true,
1051
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1052
- args: [roseRadius, roseRadius, roseThickness, 32, 1, false, 0, Math.PI]
1053
- })
1054
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1055
- "position-y": -roseRadius,
1056
- rotation: [-Math.PI / 2, Math.PI / 2, 0],
1057
- material: availableMaterials.aluminum,
1058
- castShadow: true,
1059
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1060
- args: [roseRadius, roseRadius, roseThickness, 32, 1, false, 0, Math.PI]
1061
- })
1062
- })]
1063
- }) :
1064
- /*#__PURE__*/
1065
- // --- Round rose ---
1066
- jsxRuntime.jsx("mesh", {
1067
- rotation: [Math.PI / 2, 0, 0],
1068
- "position-z": z,
1069
- material: availableMaterials.aluminum,
1070
- castShadow: true,
1071
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1072
- args: [roseRadius, roseRadius, roseThickness, 48]
1073
- })
1074
- }), frameType === "WDGF_WDG100" ? /*#__PURE__*/jsxRuntime.jsxs("group", {
1075
- "position-z": z,
1076
- "position-y": -(0.08 + roseGapY),
1077
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1078
- material: availableMaterials.aluminum,
1079
- castShadow: true,
1080
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1081
- args: [(roseRadius - 0.008) * 2, (roseRadius - 0.008) * 2, roseThickness]
1082
- })
1083
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1084
- "position-y": roseRadius - 0.008,
1085
- rotation: [Math.PI / 2, Math.PI / 2, 0],
1086
- material: availableMaterials.aluminum,
1087
- castShadow: true,
1088
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1089
- args: [roseRadius - 0.008, roseRadius - 0.008, roseThickness, 32, 1, false, 0, Math.PI]
1090
- })
1091
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1092
- "position-y": -(roseRadius - 0.008),
1093
- rotation: [-Math.PI / 2, Math.PI / 2, 0],
1094
- material: availableMaterials.aluminum,
1095
- castShadow: true,
1096
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1097
- args: [roseRadius - 0.008, roseRadius - 0.008, roseThickness, 32, 1, false, 0, Math.PI]
1098
- })
1099
- })]
1100
- }) : /*#__PURE__*/jsxRuntime.jsx("mesh", {
1101
- rotation: [Math.PI / 2, 0, 0],
1102
- "position-z": z,
1103
- "position-y": -(0.08 + roseGapY),
1104
- material: availableMaterials.aluminum,
1105
- castShadow: true,
1106
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1107
- args: [roseRadius, roseRadius, roseThickness, 48]
1108
- })
1109
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1110
- position: [0, -(0.08 + roseGapY), z + (z > 0 ? roseThickness : -roseThickness)],
1111
- castShadow: true,
1112
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1113
- rotation: [Math.PI / 2, 0, 0],
1114
- position: [0, 0.0075, 0],
1115
- material: availableMaterials.aluminumBrighter,
1116
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1117
- args: [0.01, 0.01, roseThickness, 32]
1118
- })
1119
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1120
- position: [0, -0.0075, 0],
1121
- material: availableMaterials.aluminumBrighter,
1122
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1123
- args: [0.01, 0.015, roseThickness]
1124
- })
1125
- })]
1126
- })]
1127
- }, i)), /*#__PURE__*/jsxRuntime.jsxs("group", {
1128
- scale: [doorPivot === "left" ? -1 : 1, 1, 1],
1129
- children: [/*#__PURE__*/jsxRuntime.jsxs("group", {
1130
- position: [0, 0, -0.01],
1131
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1132
- position: [0, 0, faceZ + roseThickness + connectorLength / 2],
1133
- rotation: [Math.PI / 2, 0, 0],
1134
- castShadow: true,
1135
- material: availableMaterials.aluminum,
1136
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1137
- args: [handleRadius, handleRadius, connectorLength, 48]
1138
- })
1139
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1140
- position: [0, 0, cornerFrontZ],
1141
- castShadow: true,
1142
- material: availableMaterials.aluminum,
1143
- children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
1144
- args: [handleRadius, 32, 32]
1145
- })
1146
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1147
- position: [handleLength / 2, 0, cornerFrontZ],
1148
- rotation: [0, 0, Math.PI / 2],
1149
- castShadow: true,
1150
- material: availableMaterials.aluminum,
1151
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1152
- args: [handleRadius, handleRadius, handleLength, 48]
1153
- })
1154
- })]
1155
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1156
- position: [0, 0, 0.01],
1157
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1158
- position: [0, 0, -faceZ - roseThickness - connectorLength / 2],
1159
- rotation: [Math.PI / 2, 0, 0],
1160
- castShadow: true,
1161
- material: availableMaterials.aluminum,
1162
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1163
- args: [handleRadius, handleRadius, connectorLength, 48]
1164
- })
1165
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1166
- position: [0, 0, cornerBackZ],
1167
- castShadow: true,
1168
- material: availableMaterials.aluminum,
1169
- children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
1170
- args: [handleRadius, 32, 32]
1171
- })
1172
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1173
- position: [handleLength / 2, 0, cornerBackZ],
1174
- rotation: [0, 0, Math.PI / 2],
1175
- castShadow: true,
1176
- material: availableMaterials.aluminum,
1177
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1178
- args: [handleRadius, handleRadius, handleLength, 48]
1179
- })
1180
- })]
1181
- })]
1182
- })]
1183
- });
1184
- }
1185
-
1186
- // {
1187
- // /* MergedPlate */
1188
- // }
1189
-
1190
- const MergedPlate = _ref2 => {
1191
- let {
1192
- plateMaterial,
1193
- roseThickness,
1194
- faceZ
1195
- } = _ref2;
1196
- const geometry = React.useMemo(() => {
1197
- const shape = new THREE__namespace.Shape();
1198
- const width = 0.1;
1199
- const height = 0.24;
1200
- const radius = 0.01;
1201
- shape.moveTo(-width / 2, -height / 2);
1202
- shape.lineTo(-width / 2, height / 2);
1203
- shape.lineTo(width / 2 - radius, height / 2);
1204
- shape.absarc(width / 2 - radius, height / 2 - radius, radius, Math.PI / 2, 0, true);
1205
- shape.lineTo(width / 2, -height / 2 + radius);
1206
- shape.absarc(width / 2 - radius, -height / 2 + radius, radius, 0, -Math.PI / 2, true);
1207
- shape.lineTo(-width / 2, -height / 2);
1208
- const extrudeSettings = {
1209
- steps: 2,
1210
- depth: roseThickness,
1211
- bevelEnabled: false
1212
- };
1213
- return new THREE__namespace.ExtrudeGeometry(shape, extrudeSettings);
1214
- }, [roseThickness]);
1215
- return /*#__PURE__*/jsxRuntime.jsx("group", {
1216
- "position-z": faceZ,
1217
- children: /*#__PURE__*/jsxRuntime.jsx("mesh", {
1218
- geometry: geometry,
1219
- material: plateMaterial,
1220
- castShadow: true
1221
- })
1222
- });
1223
- };
1224
-
1225
- // {
1226
- // /* GlassHandle */
1227
- // }
1228
-
1229
- function GlassHandle(_ref3) {
1230
- let {
1231
- position,
1232
- doorDepthM,
1233
- doorPivot
1234
- } = _ref3;
1235
- const roseRadius = 0.035;
1236
- const roseThickness = 0.005;
1237
- const handleRadius = 0.015;
1238
- const handleLength = 0.2;
1239
- const faceZ = doorDepthM / 2 + roseThickness / 2;
1240
- const connectorLength = handleLength / 3;
1241
- return /*#__PURE__*/jsxRuntime.jsxs("group", {
1242
- position: position,
1243
- children: [[faceZ, -faceZ].map((z, i) => /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
1244
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1245
- rotation: [Math.PI / 2, 0, 0],
1246
- "position-z": z + (z > 0 ? roseThickness : -roseThickness) + 0.002,
1247
- material: availableMaterials.aluminum,
1248
- castShadow: true,
1249
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1250
- args: [roseRadius, roseRadius, roseThickness, 48]
1251
- })
1252
- }), /*#__PURE__*/jsxRuntime.jsxs("mesh", {
1253
- position: [0, -0.08, z + (z > 0 ? roseThickness : -roseThickness)],
1254
- castShadow: true,
1255
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1256
- rotation: [Math.PI / 2, 0, 0],
1257
- position: [0, 0.0075, 0],
1258
- material: availableMaterials.aluminum,
1259
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1260
- args: [0.01, 0.01, roseThickness, 32]
1261
- })
1262
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1263
- position: [0, -0.0075, 0],
1264
- material: availableMaterials.aluminum,
1265
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1266
- args: [0.01, 0.015, roseThickness]
1267
- })
1268
- })]
1269
- })]
1270
- }, i)), /*#__PURE__*/jsxRuntime.jsxs("group", {
1271
- "scale-x": doorPivot === "left" ? -1 : 1,
1272
- children: [[faceZ, -faceZ].map((z, i) => /*#__PURE__*/jsxRuntime.jsx(MergedPlate, {
1273
- faceZ: z,
1274
- plateMaterial: availableMaterials.aluminumExtraBrighter,
1275
- roseThickness: roseThickness
1276
- }, "plate-".concat(i))), /*#__PURE__*/jsxRuntime.jsxs("group", {
1277
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1278
- position: [handleLength / 2, 0, faceZ + connectorLength],
1279
- rotation: [0, 0, Math.PI / 2],
1280
- material: availableMaterials.aluminum,
1281
- castShadow: true,
1282
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1283
- args: [handleRadius, handleRadius, handleLength, 48]
1284
- })
1285
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1286
- position: [0, 0, faceZ + connectorLength / 2],
1287
- rotation: [Math.PI / 2, 0, 0],
1288
- material: availableMaterials.aluminum,
1289
- castShadow: true,
1290
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1291
- args: [handleRadius, handleRadius, connectorLength, 48]
1292
- })
1293
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1294
- position: [0, 0, faceZ + connectorLength],
1295
- material: availableMaterials.aluminum,
1296
- castShadow: true,
1297
- children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
1298
- args: [handleRadius, 32, 32]
1299
- })
1300
- })]
1301
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1302
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1303
- position: [handleLength / 2, 0, -(faceZ + connectorLength)],
1304
- rotation: [0, 0, Math.PI / 2],
1305
- material: availableMaterials.aluminum,
1306
- castShadow: true,
1307
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1308
- args: [handleRadius, handleRadius, handleLength, 48]
1309
- })
1310
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1311
- position: [0, 0, -(faceZ + connectorLength / 2)],
1312
- rotation: [Math.PI / 2, 0, 0],
1313
- material: availableMaterials.aluminum,
1314
- castShadow: true,
1315
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1316
- args: [handleRadius, handleRadius, connectorLength, 48]
1317
- })
1318
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1319
- position: [0, 0, -(faceZ + connectorLength)],
1320
- material: availableMaterials.aluminum,
1321
- castShadow: true,
1322
- children: /*#__PURE__*/jsxRuntime.jsx("sphereGeometry", {
1323
- args: [handleRadius, 32, 32]
1324
- })
1325
- })]
1326
- })]
1327
- })]
1328
- });
1329
- }
1330
-
1331
- // {
1332
- // /* DoorHandle */
1333
- // }
1334
- function DoorHandle(_ref4) {
1335
- let {
1336
- bodyType,
1337
- handleX,
1338
- handleHeightM,
1339
- doorDepthM,
1340
- doorPivot
1341
- } = _ref4;
1342
- const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
1343
- const handlePos = [handleX, handleHeightM, 0];
1344
- const {
1345
- frameType
1346
- } = useConfigurator();
1347
- return isSingleGlass ? /*#__PURE__*/jsxRuntime.jsx(GlassHandle, {
1348
- position: [handleX, handleHeightM, -0.0024],
1349
- doorDepthM: doorDepthM,
1350
- doorPivot: doorPivot
1351
- }) : /*#__PURE__*/jsxRuntime.jsx(StandardHandle, {
1352
- position: handlePos,
1353
- doorDepthM: doorDepthM,
1354
- doorPivot: doorPivot,
1355
- frameType: frameType
1356
- });
1357
- }
1358
-
1359
- // {
1360
- // /* GlassHinge */
1361
- // }
1362
-
1363
- function GlassHinge(_ref5) {
1364
- let {
1365
- position,
1366
- pivot,
1367
- frameSideWidth,
1368
- doorDepthM,
1369
- material,
1370
- gasketMaterial
1371
- } = _ref5;
1372
- const plateWidth = 130 / 1000;
1373
- const plateHeight = 55 / 1000;
1374
- const plateThickness = 8 / 1000;
1375
- const gasketThickness = 1 / 1000;
1376
- const pivotRadius = 10 / 1000;
1377
- const pivotHeight = plateHeight;
1378
- const sideMultiplier = pivot === "left" ? 1 : -1;
1379
- const plateOffsetX = sideMultiplier * (plateWidth / 2 + frameSideWidth);
1380
- const holeRadius = 10 / 1000;
1381
- const holeSpacingX = 45 / 1000;
1382
- return /*#__PURE__*/jsxRuntime.jsxs("group", {
1383
- position: position,
1384
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1385
- material: material,
1386
- castShadow: true,
1387
- receiveShadow: true,
1388
- "position-x": 0.01,
1389
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1390
- args: [pivotRadius, pivotRadius, pivotHeight, 32]
1391
- })
1392
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1393
- "position-x": plateOffsetX,
1394
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1395
- "position-z": -(doorDepthM / 2) - plateThickness / 2 - gasketThickness,
1396
- material: material,
1397
- castShadow: true,
1398
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1399
- args: [plateWidth, plateHeight, plateThickness]
1400
- })
1401
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1402
- "position-z": -(doorDepthM / 2) - gasketThickness / 2,
1403
- material: gasketMaterial,
1404
- castShadow: true,
1405
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1406
- args: [plateWidth, plateHeight, gasketThickness]
1407
- })
1408
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1409
- "position-z": doorDepthM / 2 + plateThickness / 2 + gasketThickness,
1410
- castShadow: true,
1411
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
1412
- useGroups: true,
1413
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
1414
- material: material,
1415
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1416
- args: [plateWidth, plateHeight, plateThickness]
1417
- })
1418
- }), /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1419
- position: [-sideMultiplier * (holeSpacingX / 2), 0, 0],
1420
- rotation: [Math.PI / 2, 0, 0],
1421
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1422
- args: [holeRadius, holeRadius, plateThickness + 0.01, 32]
1423
- })
1424
- }), /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1425
- position: [sideMultiplier * (holeSpacingX / 2), 0, 0],
1426
- rotation: [Math.PI / 2, 0, 0],
1427
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
1428
- args: [holeRadius, holeRadius, plateThickness + 0.01, 32]
1429
- })
1430
- })]
1431
- })
1432
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1433
- "position-z": doorDepthM / 2 + gasketThickness / 2,
1434
- material: gasketMaterial,
1435
- castShadow: true,
1436
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1437
- args: [plateWidth, plateHeight, gasketThickness]
1438
- })
1439
- })]
1440
- })]
1441
- });
1442
- }
1443
- // {
1444
- // /* DoorStopCutsProps */
1445
- // }
1446
-
1447
- // {
1448
- // /* DoorStopCuts */
1449
- // }
1450
- function DoorStopCuts(_ref6) {
1451
- let {
1452
- visible,
1453
- width,
1454
- height,
1455
- stopWidth,
1456
- stopDepth,
1457
- stopPositionZ,
1458
- centerZ,
1459
- material,
1460
- setName
1461
- } = _ref6;
1462
- if (!visible) return null;
1463
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1464
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1465
- name: "cut-top-".concat(setName),
1466
- material: material,
1467
- position: [0, height / 2 - stopWidth / 2 + 0.0001, stopPositionZ - centerZ],
1468
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1469
- args: [width + 0.01, stopWidth, stopDepth + 0.01]
1470
- })
1471
- }), /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1472
- name: "cut-left-".concat(setName),
1473
- material: material,
1474
- position: [-width / 2 + stopWidth / 2 - 0.0001, 0, stopPositionZ - centerZ],
1475
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1476
- args: [stopWidth, height + 0.01, stopDepth + 0.01]
1477
- })
1478
- }), /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1479
- name: "cut-right-".concat(setName),
1480
- material: material,
1481
- position: [width / 2 - stopWidth / 2 + 0.0001, 0, stopPositionZ - centerZ],
1482
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1483
- args: [stopWidth, height + 0.01, stopDepth + 0.01]
1484
- })
1485
- })]
1486
- });
1487
- }
1488
-
1489
- // {
1490
- // /* DoorModelsProps */
1491
- // }
1492
-
1493
- // {
1494
- // /* AllMaterialsType */
1495
- // }
1496
-
1497
- // {
1498
- // /* DoorLeafProps */
1499
- // }
1500
-
1501
- // {
1502
- // /* DoorModels */
1503
- // }
1504
-
1505
- function DoorModels(_ref7) {
1506
- let {
1507
- doorName,
1508
- materials: materialsProp,
1509
- doorPivot: doorPivotProp,
1510
- doorOpening: doorOpeningProp,
1511
- totalWidth: totalWidthProp,
1512
- totalHeight: totalHeightProp,
1513
- totalDepth: totalDepthProp
1514
- } = _ref7;
1515
- const {
1516
- is2D,
1517
- totalWidth,
1518
- isFrameVisible,
1519
- door,
1520
- setDoor,
1521
- doorFrame,
1522
- setDoorFrame,
1523
- interiorFanlight,
1524
- exteriorFanlight,
1525
- frontCoverPanel,
1526
- backCoverPanel,
1527
- frameType,
1528
- glassVisible,
1529
- glassDepth,
1530
- handleParseCpid,
1531
- isDoubleDoor,
1532
- setMaterials,
1533
- setTotalWidth,
1534
- setTotalHeight,
1535
- setTotalDepth
1536
- } = useConfigurator();
1537
- React.useEffect(() => {
1538
- if (doorName) {
1539
- handleParseCpid(doorName);
1540
- }
1541
- }, [doorName, handleParseCpid]);
1542
- React.useEffect(() => {
1543
- if (materialsProp) {
1544
- setMaterials(materialsProp);
1545
- }
1546
- }, [materialsProp, setMaterials]);
1547
- React.useEffect(() => {
1548
- if (doorPivotProp || doorOpeningProp) {
1549
- setDoor(prevDoor => _objectSpread2(_objectSpread2(_objectSpread2({}, prevDoor), doorPivotProp && {
1550
- doorPivot: doorPivotProp
1551
- }), doorOpeningProp && {
1552
- doorOpening: doorOpeningProp
1553
- }));
1554
- }
1555
- }, [doorPivotProp, doorOpeningProp, setDoor]);
1556
- React.useEffect(() => {
1557
- if (totalWidthProp !== undefined) {
1558
- setTotalWidth(totalWidthProp);
1559
- }
1560
- }, [totalWidthProp, setTotalWidth]);
1561
- React.useEffect(() => {
1562
- if (totalHeightProp !== undefined) {
1563
- setTotalHeight(totalHeightProp);
1564
- }
1565
- }, [totalHeightProp, setTotalHeight]);
1566
- React.useEffect(() => {
1567
- if (totalDepthProp !== undefined) {
1568
- setTotalDepth(totalDepthProp);
1569
- }
1570
- }, [totalDepthProp, setTotalDepth]);
1571
-
1572
- // --- Material Logic (Centralized in parent component) ---
1573
- const allMaterials = useDoorMaterials(materialsProp);
1574
-
1575
- // --- Dimension calculations ---
1576
- const {
1577
- doorWidth,
1578
- doorHeight,
1579
- theDoorDepth
1580
- } = door;
1581
- const doorPivot = doorPivotProp || door.doorPivot;
1582
- const doorOpening = doorOpeningProp || door.doorOpening;
1583
- const {
1584
- frameDepth,
1585
- topThk,
1586
- sidesThk,
1587
- doorStopWidth,
1588
- doorStopDepth,
1589
- doorStopOffset,
1590
- notchWidth,
1591
- notchDepth,
1592
- notchposition,
1593
- gasketWidth,
1594
- gasketDepth,
1595
- secondDoorStopWidth,
1596
- secondDoorStopDepth
1597
- } = doorFrame;
1598
- const initialDoorHeight = React.useRef(null);
1599
- React.useEffect(() => {
1600
- if (initialDoorHeight.current === null && doorHeight > 0) {
1601
- initialDoorHeight.current = doorHeight;
1602
- }
1603
- }, [doorHeight]);
1604
- const pivotNewPosition = React.useMemo(() => {
1605
- if (initialDoorHeight.current === null || initialDoorHeight.current === 0) return 0;
1606
- return (doorHeight - initialDoorHeight.current) / 2 / 1000;
1607
- }, [doorHeight]);
1608
- const {
1609
- height: interiorFanlightHeightValue
1610
- } = interiorFanlight;
1611
- const {
1612
- height: exteriorFanlightHeightValue,
1613
- depth: exteriorFanlightDepthValue
1614
- } = exteriorFanlight;
1615
- const {
1616
- width: architraveWidth,
1617
- depth: architraveDepth
1618
- } = frontCoverPanel;
1619
- const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlightHeightValue : 0;
1620
- const topThkValue = parseInt(topThk) || 20;
1621
- const sidesThkValue = parseInt(sidesThk) || 20;
1622
-
1623
- // Convert dimensions from mm to meters
1624
- const totalWidthM = totalWidthProp !== undefined ? totalWidthProp / 1000 : totalWidth / 1000;
1625
- const totalHeightM = totalHeightProp !== undefined ? totalHeightProp / 1000 : doorHeight / 1000;
1626
- const interiorFanlightHeightM = interiorFanlightHeight / 1000;
1627
- const doorWidthM = doorWidth / 1000;
1628
- const totalOpeningHeightM = doorHeight / 1000;
1629
- const doorDepthM = theDoorDepth / 1000;
1630
- const frameDepthM = frameDepth / 1000;
1631
- const topFrameWidthM = topThkValue / 1000;
1632
- const sidesFrameWidthM = sidesThkValue / 1000;
1633
- const totalOpeningWidthM = isDoubleDoor ? doorWidthM * 2 : doorWidthM;
1634
- const exteriorFanlightHeightM = exteriorFanlight.visible ? exteriorFanlightHeightValue / 1000 : 0;
1635
- const exteriorFanlightDepthM = exteriorFanlightDepthValue / 1000;
1636
- const doorStopWidthM = doorStopWidth / 1000;
1637
- const doorStopDepthM = doorStopDepth / 1000;
1638
- const architraveProfileM = architraveWidth / 1000;
1639
- const architraveDepthM = architraveDepth / 1000;
1640
- const gasketWidthM = gasketWidth / 1000;
1641
- const gasketDepthM = gasketDepth / 1000;
1642
- const doorStopOffsetFromEdgeM = parseInt(doorStopOffset) / 1000;
1643
- const notchWidthM = (parseInt(notchWidth) || 20) / 1000;
1644
- const notchDepthM = (parseInt(notchDepth) || 40) / 1000;
1645
- const isOpeningIn = doorOpening === "in";
1646
- const doorStopPositionZ = React.useMemo(() => isOpeningIn ? frameDepthM / 2 - doorStopOffsetFromEdgeM - doorStopDepthM / 2 : -frameDepthM / 2 + doorStopOffsetFromEdgeM + doorStopDepthM / 2, [isOpeningIn, frameDepthM, doorStopOffsetFromEdgeM, doorStopDepthM]);
1647
- const gasketZPosition = React.useMemo(() => isOpeningIn ? doorStopPositionZ - doorStopDepthM / 2 - gasketDepthM / 2 : doorStopPositionZ + doorStopDepthM / 2 + gasketDepthM / 2, [isOpeningIn, doorStopPositionZ, doorStopDepthM, gasketDepthM]);
1648
- const secondDoorStopWidthM = secondDoorStopWidth / 1000;
1649
- const secondDoorStopDepthM = secondDoorStopDepth / 1000;
1650
- const secondDoorStopPositionZ = isOpeningIn ? frameDepthM / 2 - secondDoorStopDepthM / 2 : -frameDepthM / 2 + secondDoorStopDepthM / 2;
1651
- const secondGasketZPosition = isOpeningIn ? secondDoorStopPositionZ - secondDoorStopDepthM / 2 - gasketDepthM / 2 : secondDoorStopPositionZ + secondDoorStopDepthM / 2 + gasketDepthM / 2;
1652
- const doorCenterZ = React.useMemo(() => {
1653
- if (frameType === "WF_FLI") {
1654
- return isOpeningIn ? frameDepthM / 2 - doorDepthM / 2 : -frameDepthM / 2 + doorDepthM / 2;
1655
- }
1656
- if (["WDGF_WDG100", "WF_100"].includes(frameType)) {
1657
- return 0;
1658
- }
1659
- const gasketFaceZ = isOpeningIn ? gasketZPosition - gasketDepthM / 2 : gasketZPosition + gasketDepthM / 2;
1660
- return isOpeningIn ? gasketFaceZ - doorDepthM / 2 : gasketFaceZ + doorDepthM / 2;
1661
- }, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
1662
- const GlassPanelDepthM = glassDepth / 1000;
1663
- const doorInstances = React.useMemo(() => {
1664
- if (isDoubleDoor) {
1665
- return [{
1666
- key: "left",
1667
- pivot: "left",
1668
- x: -doorWidthM / 2
1669
- }, {
1670
- key: "right",
1671
- pivot: "right",
1672
- x: doorWidthM / 2
1673
- }];
1674
- }
1675
- return [{
1676
- key: "single",
1677
- pivot: doorPivot,
1678
- x: 0
1679
- }];
1680
- }, [isDoubleDoor, doorWidthM, doorPivot]);
1681
-
1682
- // --- Centering & Positioning ---
1683
- const yCenteringOffset = -topFrameWidthM / 2;
1684
- const sideFrameCenterY = topFrameWidthM / 2;
1685
- const interiorFanlightYPosition = totalOpeningHeightM / 2 - interiorFanlightHeightM / 2;
1686
- const topFrameCenterY = totalOpeningHeightM / 2 + topFrameWidthM / 2;
1687
- const exteriorFanlightYPosition = topFrameCenterY + topFrameWidthM / 2 + exteriorFanlightHeightM / 2;
1688
- const frontArchitraveZ = frameDepthM / 2 + architraveDepthM / 2;
1689
- const backArchitraveZ = -frameDepthM / 2 - architraveDepthM / 2;
1690
- const leftArchitraveX = -totalOpeningWidthM / 2 - architraveProfileM / 2;
1691
- const rightArchitraveX = totalOpeningWidthM / 2 + architraveProfileM / 2;
1692
- const topArchitraveY = totalOpeningHeightM / 2 + architraveProfileM / 2;
1693
- const topArchitraveWidth = totalOpeningWidthM + 2 * architraveProfileM;
1694
- const topGasketYPosition = totalOpeningHeightM / 2 - doorStopWidthM + gasketWidthM / 2;
1695
- const leftGasketXPosition = -totalOpeningWidthM / 2 + doorStopWidthM - gasketWidthM / 2;
1696
- const rightGasketXPosition = totalOpeningWidthM / 2 - doorStopWidthM + gasketWidthM / 2;
1697
- const secondTopGasketYPosition = totalOpeningHeightM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
1698
- const secondLeftGasketXPosition = -totalOpeningWidthM / 2 + secondDoorStopWidthM - gasketWidthM / 2;
1699
- const secondRightGasketXPosition = totalOpeningWidthM / 2 - secondDoorStopWidthM + gasketWidthM / 2;
1700
- const leftGlass_Z = -frameDepthM / 2 + GlassPanelDepthM / 2 - GlassPanelDepthM;
1701
- const rightGlass_Z = frameDepthM / 2 - GlassPanelDepthM / 2 + GlassPanelDepthM;
1702
- if (is2D) {
1703
- return /*#__PURE__*/jsxRuntime.jsx("group", {
1704
- "position-y": yCenteringOffset + 0.1,
1705
- children: /*#__PURE__*/jsxRuntime.jsxs("mesh", {
1706
- children: [/*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1707
- args: [totalWidth / 1000, 0.1, frameDepth / 1000]
1708
- }), /*#__PURE__*/jsxRuntime.jsx("meshBasicMaterial", {
1709
- color: "white",
1710
- side: THREE__namespace.DoubleSide
1711
- })]
1712
- })
1713
- });
1714
- }
1715
- return /*#__PURE__*/jsxRuntime.jsxs("group", {
1716
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1717
- visible: false,
1718
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1719
- args: [totalWidthM, totalHeightM, frameDepthM]
1720
- })
1721
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1722
- "position-y": yCenteringOffset + pivotNewPosition,
1723
- children: [frontCoverPanel.visible && /*#__PURE__*/jsxRuntime.jsxs("group", {
1724
- "position-z": frontArchitraveZ,
1725
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1726
- position: [0, topArchitraveY, 0],
1727
- castShadow: true,
1728
- material: allMaterials.frontCoverPanelMaterial,
1729
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1730
- args: [topArchitraveWidth, architraveProfileM, architraveDepthM]
1731
- })
1732
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1733
- position: [leftArchitraveX, 0, 0],
1734
- castShadow: true,
1735
- material: allMaterials.frontCoverPanelMaterial,
1736
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1737
- args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
1738
- })
1739
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1740
- position: [rightArchitraveX, 0, 0],
1741
- castShadow: true,
1742
- material: allMaterials.frontCoverPanelMaterial,
1743
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1744
- args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
1745
- })
1746
- })]
1747
- }), backCoverPanel.visible && /*#__PURE__*/jsxRuntime.jsxs("group", {
1748
- "position-z": backArchitraveZ,
1749
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1750
- position: [0, topArchitraveY, 0],
1751
- castShadow: true,
1752
- material: allMaterials.backCoverPanelMaterial,
1753
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1754
- args: [topArchitraveWidth, architraveProfileM, architraveDepthM]
1755
- })
1756
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1757
- position: [leftArchitraveX, 0, 0],
1758
- castShadow: true,
1759
- material: allMaterials.backCoverPanelMaterial,
1760
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1761
- args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
1762
- })
1763
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1764
- position: [rightArchitraveX, 0, 0],
1765
- castShadow: true,
1766
- material: allMaterials.backCoverPanelMaterial,
1767
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1768
- args: [architraveProfileM, totalOpeningHeightM, architraveDepthM]
1769
- })
1770
- })]
1771
- }), exteriorFanlight.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
1772
- position: [0, exteriorFanlightYPosition, 0],
1773
- castShadow: true,
1774
- material: allMaterials.exteriorFanlightMaterial,
1775
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1776
- args: [totalOpeningWidthM + sidesFrameWidthM * 2, exteriorFanlightHeightM, exteriorFanlightDepthM]
1777
- })
1778
- }), isFrameVisible && /*#__PURE__*/jsxRuntime.jsxs("group", {
1779
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1780
- castShadow: true,
1781
- position: [0, topFrameCenterY, 0],
1782
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
1783
- useGroups: true,
1784
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
1785
- name: "frame-base",
1786
- material: allMaterials.frameMaterial,
1787
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1788
- args: [totalOpeningWidthM, topFrameWidthM, frameDepthM]
1789
- })
1790
- }), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1791
- name: "cut-exterior",
1792
- material: allMaterials.frameMaterial,
1793
- position: [0, notchposition, 0],
1794
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1795
- args: [totalOpeningWidthM + 0.01, notchWidthM, notchDepthM]
1796
- })
1797
- })]
1798
- })
1799
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1800
- castShadow: true,
1801
- position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2, sideFrameCenterY, 0],
1802
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
1803
- useGroups: true,
1804
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
1805
- name: "frame-base",
1806
- material: allMaterials.frameMaterial,
1807
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1808
- args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, frameDepthM]
1809
- })
1810
- }), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1811
- name: "cut-exterior",
1812
- material: allMaterials.frameMaterial,
1813
- position: [-notchposition, 0, 0],
1814
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1815
- args: [notchWidthM, totalOpeningHeightM + topFrameWidthM + 0.01, notchDepthM]
1816
- })
1817
- })]
1818
- })
1819
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1820
- castShadow: true,
1821
- position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2, sideFrameCenterY, 0],
1822
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
1823
- useGroups: true,
1824
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
1825
- name: "frame-base",
1826
- material: allMaterials.frameMaterial,
1827
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1828
- args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, frameDepthM]
1829
- })
1830
- }), !["MXF_40", "MXF_50", "MXCAF_40", "MXCAF_50"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
1831
- name: "cut-exterior",
1832
- material: allMaterials.frameMaterial,
1833
- position: [notchposition, 0, 0],
1834
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1835
- args: [notchWidthM, totalOpeningHeightM + topFrameWidthM + 0.01, notchDepthM]
1836
- })
1837
- })]
1838
- })
1839
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1840
- castShadow: true,
1841
- position: [0, totalOpeningHeightM / 2 - doorStopWidthM / 2, doorStopPositionZ],
1842
- material: allMaterials.doorStopMaterial,
1843
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1844
- args: [totalOpeningWidthM, doorStopWidthM, doorStopDepthM]
1845
- })
1846
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1847
- castShadow: true,
1848
- position: [-totalOpeningWidthM / 2 + doorStopWidthM / 2, 0, doorStopPositionZ],
1849
- material: allMaterials.doorStopMaterial,
1850
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1851
- args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
1852
- })
1853
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1854
- castShadow: true,
1855
- position: [totalOpeningWidthM / 2 - doorStopWidthM / 2, 0, doorStopPositionZ],
1856
- material: allMaterials.doorStopMaterial,
1857
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1858
- args: [doorStopWidthM, totalOpeningHeightM, doorStopDepthM]
1859
- })
1860
- }), frameType !== "WF_FLI" && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1861
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1862
- castShadow: true,
1863
- position: [0, topGasketYPosition, gasketZPosition],
1864
- material: allMaterials.gasketMaterial,
1865
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1866
- args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
1867
- })
1868
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1869
- castShadow: true,
1870
- position: [leftGasketXPosition - 0.005, -0.005, gasketZPosition],
1871
- material: allMaterials.gasketMaterial,
1872
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1873
- args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.02, gasketDepthM]
1874
- })
1875
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1876
- castShadow: true,
1877
- position: [rightGasketXPosition + 0.005, -0.005, gasketZPosition],
1878
- material: allMaterials.gasketMaterial,
1879
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1880
- args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.02, gasketDepthM]
1881
- })
1882
- })]
1883
- }), ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsxs("group", {
1884
- children: [/*#__PURE__*/jsxRuntime.jsxs("group", {
1885
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1886
- castShadow: true,
1887
- position: [0, totalOpeningHeightM / 2 - secondDoorStopWidthM / 2, secondDoorStopPositionZ],
1888
- material: allMaterials.doorStopMaterial,
1889
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1890
- args: [totalOpeningWidthM, secondDoorStopWidthM, secondDoorStopDepthM]
1891
- })
1892
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1893
- castShadow: true,
1894
- position: [-totalOpeningWidthM / 2 + secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
1895
- material: allMaterials.doorStopMaterial,
1896
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1897
- args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
1898
- })
1899
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1900
- castShadow: true,
1901
- position: [totalOpeningWidthM / 2 - secondDoorStopWidthM / 2, 0, secondDoorStopPositionZ],
1902
- material: allMaterials.doorStopMaterial,
1903
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1904
- args: [secondDoorStopWidthM, totalOpeningHeightM, secondDoorStopDepthM]
1905
- })
1906
- })]
1907
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1908
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1909
- castShadow: true,
1910
- position: [0, secondTopGasketYPosition - 0.005, secondGasketZPosition],
1911
- material: allMaterials.gasketMaterial,
1912
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1913
- args: [totalOpeningWidthM - 0.03, gasketWidthM + 0.005, gasketDepthM]
1914
- })
1915
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1916
- castShadow: true,
1917
- position: [secondLeftGasketXPosition - 0.005, -0.01, secondGasketZPosition],
1918
- material: allMaterials.gasketMaterial,
1919
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1920
- args: [gasketWidthM + 0.005, totalOpeningHeightM - 0.04, gasketDepthM]
1921
- })
1922
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1923
- castShadow: true,
1924
- position: [secondRightGasketXPosition + 0.005, -0.01, secondGasketZPosition],
1925
- material: allMaterials.gasketMaterial,
1926
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1927
- args: [gasketWidthM + 0.004, totalOpeningHeightM - 0.04, gasketDepthM]
1928
- })
1929
- })]
1930
- }), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1931
- children: [/*#__PURE__*/jsxRuntime.jsxs("group", {
1932
- children: [["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
1933
- castShadow: true,
1934
- position: [0, topFrameCenterY - secondDoorStopWidthM / 2, leftGlass_Z],
1935
- material: allMaterials.glassInfillMaterial,
1936
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1937
- args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM + secondDoorStopWidthM, GlassPanelDepthM]
1938
- })
1939
- }), !["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
1940
- castShadow: true,
1941
- position: [0, topFrameCenterY, leftGlass_Z],
1942
- material: allMaterials.glassInfillMaterial,
1943
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1944
- args: [totalOpeningWidthM - 2 * secondDoorStopWidthM, topFrameWidthM, GlassPanelDepthM]
1945
- })
1946
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1947
- castShadow: true,
1948
- position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2 + secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
1949
- material: allMaterials.glassInfillMaterial,
1950
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1951
- args: [sidesFrameWidthM + secondDoorStopWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
1952
- })
1953
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1954
- castShadow: true,
1955
- position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2 - secondDoorStopWidthM / 2, sideFrameCenterY, leftGlass_Z],
1956
- material: allMaterials.glassInfillMaterial,
1957
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1958
- args: [sidesFrameWidthM + secondDoorStopWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
1959
- })
1960
- })]
1961
- }), /*#__PURE__*/jsxRuntime.jsxs("group", {
1962
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
1963
- castShadow: true,
1964
- position: [0, topFrameCenterY, rightGlass_Z],
1965
- material: allMaterials.glassInfillMaterial,
1966
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1967
- args: [totalOpeningWidthM, topFrameWidthM, GlassPanelDepthM]
1968
- })
1969
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1970
- castShadow: true,
1971
- position: [-totalOpeningWidthM / 2 - sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
1972
- material: allMaterials.glassInfillMaterial,
1973
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1974
- args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
1975
- })
1976
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
1977
- castShadow: true,
1978
- position: [totalOpeningWidthM / 2 + sidesFrameWidthM / 2, sideFrameCenterY, rightGlass_Z],
1979
- material: allMaterials.glassInfillMaterial,
1980
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1981
- args: [sidesFrameWidthM, totalOpeningHeightM + topFrameWidthM, GlassPanelDepthM]
1982
- })
1983
- })]
1984
- })]
1985
- })]
1986
- })]
1987
- }), interiorFanlight.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
1988
- position: [0, interiorFanlightYPosition, doorCenterZ],
1989
- castShadow: true,
1990
- material: allMaterials.interiorFanlightMaterial,
1991
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
1992
- args: [totalOpeningWidthM, interiorFanlightHeightM, doorDepthM]
1993
- })
1994
- }), doorInstances.map(instance => /*#__PURE__*/jsxRuntime.jsx(DoorLeaf, {
1995
- pivot: instance.pivot,
1996
- xOffset: instance.x,
1997
- materials: allMaterials
1998
- }, instance.key))]
1999
- })]
2000
- });
2001
- }
2002
-
2003
- // {
2004
- // /* DoorLeaf */
2005
- // }
2006
- function DoorLeaf(_ref8) {
2007
- let {
2008
- pivot,
2009
- xOffset,
2010
- materials
2011
- } = _ref8;
2012
- // Destructure materials from props.
2013
- const {
2014
- doorMaterial,
2015
- glassInfillMaterial,
2016
- hingeBodyMaterial,
2017
- gasketMaterial,
2018
- occulusInfillMaterial,
2019
- frontDoorPlaneMaterial,
2020
- backDoorPlaneMaterial,
2021
- hingeAccentMaterial
2022
- } = materials;
2023
-
2024
- // Get NON-MATERIAL state from the context.
2025
- const {
2026
- isFrameVisible,
2027
- door,
2028
- doorFrame,
2029
- interiorFanlight,
2030
- occulus,
2031
- frontDoorPlane,
2032
- backDoorPlane,
2033
- frameType,
2034
- bodyType,
2035
- exteriorFanlightType,
2036
- glassVisible,
2037
- glassDepth
2038
- } = useConfigurator();
2039
-
2040
- // --- Dimension calculations ---
2041
- const {
2042
- doorWidth,
2043
- doorHeight,
2044
- theDoorDepth,
2045
- doorOpening
2046
- } = door;
2047
- const {
2048
- frameDepth,
2049
- topThk,
2050
- sidesThk,
2051
- doorStopWidth,
2052
- doorStopDepth,
2053
- doorStopOffset,
2054
- gasketDepth,
2055
- secondDoorStopWidth,
2056
- secondDoorStopDepth
2057
- } = doorFrame;
2058
- const initialDoorHeight = React.useRef(null);
2059
- React.useEffect(() => {
2060
- if (doorHeight > 0 && initialDoorHeight.current === null) {
2061
- initialDoorHeight.current = doorHeight;
2062
- }
2063
- }, [doorHeight]);
2064
- const {
2065
- x1: occulusX1,
2066
- x2: occulusX2,
2067
- y1: occulusY1,
2068
- y2: occulusY2,
2069
- depth: occulusInfillDepth
2070
- } = occulus;
2071
- const interiorFanlightHeight = interiorFanlight.visible ? interiorFanlight.height : 0;
2072
- const mainDoorHeight = doorHeight - interiorFanlightHeight;
2073
- const sidesThkValue = parseInt(sidesThk) || 20;
2074
-
2075
- // Convert dimensions from mm to meters
2076
- const doorWidthM = doorWidth / 1000;
2077
- const mainDoorHeightM = mainDoorHeight / 1000;
2078
- const totalOpeningHeightM = doorHeight / 1000;
2079
- const doorDepthM = theDoorDepth / 1000;
2080
- const frameDepthM = frameDepth / 1000;
2081
- const sidesFrameWidthM = sidesThkValue / 1000;
2082
- const occulusX1M = occulusX1 / 1000;
2083
- const occulusX2M = occulusX2 / 1000;
2084
- const occulusY1M = occulusY1 / 1000;
2085
- const occulusY2M = occulusY2 / 1000;
2086
- const occulusInfillDepthM = occulusInfillDepth / 1000;
2087
- const doorStopWidthM = doorStopWidth / 1000;
2088
- const doorStopDepthM = doorStopDepth / 1000;
2089
- const gasketDepthM = gasketDepth / 1000;
2090
- const doorStopOffsetFromEdgeM = parseInt(doorStopOffset) / 1000;
2091
- const isOpeningIn = doorOpening === "in";
2092
- const doorStopPositionZ = React.useMemo(() => isOpeningIn ? frameDepthM / 2 - doorStopOffsetFromEdgeM - doorStopDepthM / 2 : -frameDepthM / 2 + doorStopOffsetFromEdgeM + doorStopDepthM / 2, [isOpeningIn, frameDepthM, doorStopOffsetFromEdgeM, doorStopDepthM]);
2093
- const gasketZPosition = React.useMemo(() => isOpeningIn ? doorStopPositionZ - doorStopDepthM / 2 - gasketDepthM / 2 : doorStopPositionZ + doorStopDepthM / 2 + gasketDepthM / 2, [isOpeningIn, doorStopPositionZ, doorStopDepthM, gasketDepthM]);
2094
- const secondDoorStopWidthM = secondDoorStopWidth / 1000;
2095
- const secondDoorStopDepthM = secondDoorStopDepth / 1000;
2096
- const secondDoorStopPositionZ = isOpeningIn ? frameDepthM / 2 - secondDoorStopDepthM / 2 : -frameDepthM / 2 + secondDoorStopDepthM / 2;
2097
- const doorCenterZ = React.useMemo(() => {
2098
- if (frameType === "WF_FLI") {
2099
- return isOpeningIn ? frameDepthM / 2 - doorDepthM / 2 : -frameDepthM / 2 + doorDepthM / 2;
2100
- }
2101
- if (["WDGF_WDG100", "WF_100"].includes(frameType)) {
2102
- return 0;
2103
- }
2104
- const gasketFaceZ = isOpeningIn ? gasketZPosition - gasketDepthM / 2 : gasketZPosition + gasketDepthM / 2;
2105
- return isOpeningIn ? gasketFaceZ - doorDepthM / 2 : gasketFaceZ + doorDepthM / 2;
2106
- }, [isOpeningIn, gasketZPosition, gasketDepthM, doorDepthM, frameType, frameDepthM]);
2107
- const GlassPanelDepthM = glassDepth / 1000;
2108
- const frontGlassOffsetZ = doorDepthM / 2 + GlassPanelDepthM / 2;
2109
- const backGlassOffsetZ = -doorDepthM / 2 - GlassPanelDepthM / 2;
2110
- const occulusWidthM = doorWidthM - occulusX1M - occulusX2M;
2111
- const occulusHeightM = mainDoorHeightM - occulusY1M - occulusY2M;
2112
- const occulusPositionXM = (occulusX1M - occulusX2M) / 2;
2113
- const occulusPositionYM = (occulusY2M - occulusY1M) / 2;
2114
- React.useEffect(() => {
2115
- const materialsToUpdate = [frontDoorPlaneMaterial, backDoorPlaneMaterial];
2116
- materialsToUpdate.forEach(material => {
2117
- // Check if the material has a texture map
2118
- if (material.map) {
2119
- // Set the texture to repeat
2120
- material.map.wrapS = THREE__namespace.RepeatWrapping;
2121
- material.map.wrapT = THREE__namespace.RepeatWrapping;
2122
- material.map.repeat.set(doorWidthM, mainDoorHeightM);
2123
- material.map.needsUpdate = true;
2124
- }
2125
- });
2126
- }, [doorWidthM, mainDoorHeightM, frontDoorPlaneMaterial, backDoorPlaneMaterial]);
2127
- const [isOpen, setIsOpen] = React.useState(false);
2128
- const hingeSideX = pivot === "left" ? -doorWidthM / 2 : doorWidthM / 2;
2129
-
2130
- // --- PIVOT ---
2131
- const hingeZ = React.useMemo(() => {
2132
- if (frameType === "WF_FLI") {
2133
- return isOpeningIn ? doorCenterZ - doorDepthM / 2 : doorCenterZ + doorDepthM / 2;
2134
- }
2135
- return isOpeningIn ? -frameDepthM / 2 : frameDepthM / 2;
2136
- }, [frameType, isOpeningIn, doorCenterZ, doorDepthM, frameDepthM]);
2137
- const doorOffsetZ = React.useMemo(() => doorCenterZ - hingeZ, [doorCenterZ, hingeZ]);
2138
- const directionMultiplier = doorOpening === "in" ? 1 : -1;
2139
- const {
2140
- rotation
2141
- } = three.useSpring({
2142
- rotation: isOpen ? [0, (pivot === "left" ? Math.PI / 2 : -Math.PI / 2) * directionMultiplier, 0] : [0, 0, 0],
2143
- config: {
2144
- mass: 1,
2145
- tension: 100,
2146
- friction: 20
2147
- }
2148
- });
2149
- const handleClick = () => setIsOpen(!isOpen);
2150
- const doorYPosition = -totalOpeningHeightM / 2 + mainDoorHeightM / 2;
2151
-
2152
- // Handle positioning logic
2153
- const handleCenterYFromDoorBottom = 1.0;
2154
- const safeHandleY = Math.min(Math.max(handleCenterYFromDoorBottom, 0.25), mainDoorHeightM - 0.25);
2155
- const handleHeightM = -mainDoorHeightM / 2 + safeHandleY;
2156
- const isSingleGlass = ["SG8", "SG10", "SG12"].includes(bodyType);
2157
- const nonHingeSideX = pivot === "left" ? doorWidthM / 2 : -doorWidthM / 2;
2158
- let handleX;
2159
- if (isSingleGlass) {
2160
- const plateHalfWidth = 0.05;
2161
- handleX = nonHingeSideX + (pivot === "left" ? -plateHalfWidth : plateHalfWidth);
2162
- } else {
2163
- const latchMarginM = 0.08;
2164
- handleX = nonHingeSideX + (pivot === "left" ? -latchMarginM : latchMarginM);
2165
- }
2166
-
2167
- // Hinge dimension calculations
2168
- const hingeTotalHeightM = 120 / 1000;
2169
- const hingeRadiusM = 8 / 1000;
2170
- const capHeightM = 4 / 1000;
2171
- const separatorHeightM = 4 / 1000;
2172
- const barrelPartHeight = (hingeTotalHeightM - capHeightM * 2 - separatorHeightM) / 2;
2173
- const isGlassDoor = React.useMemo(() => ["SG8", "SG10", "SG12"].includes(bodyType), [bodyType]);
2174
-
2175
- // Hinge positioning logic
2176
- const standardHingeYPositions = React.useMemo(() => {
2177
- const numHinges = 4;
2178
- const topMargin = 180 / 1000;
2179
- const bottomMargin = 180 / 1000;
2180
- const availableHeight = mainDoorHeightM - topMargin - bottomMargin;
2181
- const spacing = availableHeight / (numHinges - 1);
2182
- return Array.from({
2183
- length: numHinges
2184
- }, (_, i) => mainDoorHeightM / 2 - topMargin - i * spacing);
2185
- }, [mainDoorHeightM]);
2186
- const glassHingeYPositions = React.useMemo(() => {
2187
- return [mainDoorHeightM / 2 - 250 / 1000, mainDoorHeightM / 2 - 450 / 1000, -mainDoorHeightM / 2 + 250 / 1000];
2188
- }, [mainDoorHeightM]);
2189
- const isStandardHingeVisible = React.useMemo(() => {
2190
- if (isGlassDoor || !isFrameVisible) return false;
2191
- return !["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType);
2192
- }, [isFrameVisible, frameType, isGlassDoor]);
2193
- return /*#__PURE__*/jsxRuntime.jsxs("group", {
2194
- "position-x": xOffset,
2195
- children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
2196
- position: [hingeSideX, doorYPosition + y, hingeZ],
2197
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
2198
- material: hingeBodyMaterial,
2199
- position: [0, separatorHeightM / 2 + barrelPartHeight / 2, 0],
2200
- castShadow: true,
2201
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
2202
- args: [hingeRadiusM, hingeRadiusM, barrelPartHeight, 32]
2203
- })
2204
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
2205
- material: hingeAccentMaterial,
2206
- position: [0, separatorHeightM / 2 + barrelPartHeight + capHeightM / 2, 0],
2207
- castShadow: true,
2208
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
2209
- args: [hingeRadiusM, hingeRadiusM, capHeightM, 32]
2210
- })
2211
- })]
2212
- }, "frame-hinge-".concat(index))), /*#__PURE__*/jsxRuntime.jsxs(three.a.group, {
2213
- position: [hingeSideX, doorYPosition, hingeZ],
2214
- rotation: rotation.to((x, y, z) => [x, y, z]),
2215
- onClick: handleClick,
2216
- onPointerOver: () => document.body.style.cursor = "pointer",
2217
- onPointerOut: () => document.body.style.cursor = "auto",
2218
- children: [isStandardHingeVisible && standardHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsxs("group", {
2219
- position: [0, y, 0],
2220
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
2221
- material: hingeBodyMaterial,
2222
- position: [0, -separatorHeightM / 2 - barrelPartHeight / 2, 0],
2223
- castShadow: true,
2224
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
2225
- args: [hingeRadiusM, hingeRadiusM, barrelPartHeight, 32]
2226
- })
2227
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
2228
- material: hingeAccentMaterial,
2229
- position: [0, -separatorHeightM / 2 - barrelPartHeight - capHeightM / 2, 0],
2230
- castShadow: true,
2231
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
2232
- args: [hingeRadiusM, hingeRadiusM, capHeightM, 32]
2233
- })
2234
- }), /*#__PURE__*/jsxRuntime.jsx("mesh", {
2235
- material: hingeAccentMaterial,
2236
- position: [0, 0, 0],
2237
- castShadow: true,
2238
- children: /*#__PURE__*/jsxRuntime.jsx("cylinderGeometry", {
2239
- args: [hingeRadiusM, hingeRadiusM, separatorHeightM, 32]
2240
- })
2241
- })]
2242
- }, "door-hinge-".concat(index))), isGlassDoor && isFrameVisible && glassHingeYPositions.map((y, index) => /*#__PURE__*/jsxRuntime.jsx(GlassHinge, {
2243
- position: [0, y, doorOffsetZ + 0.0001],
2244
- pivot: pivot,
2245
- frameSideWidth: sidesFrameWidthM,
2246
- doorDepthM: doorDepthM,
2247
- material: hingeBodyMaterial,
2248
- gasketMaterial: gasketMaterial
2249
- }, "glass-hinge-".concat(index))), /*#__PURE__*/jsxRuntime.jsxs("group", {
2250
- position: [-hingeSideX, 0, doorOffsetZ],
2251
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
2252
- castShadow: true,
2253
- receiveShadow: true,
2254
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
2255
- useGroups: true,
2256
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
2257
- name: "door-base",
2258
- material: doorMaterial,
2259
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2260
- args: [doorWidthM, mainDoorHeightM, doorDepthM]
2261
- })
2262
- }), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
2263
- visible: ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType),
2264
- width: doorWidthM,
2265
- height: totalOpeningHeightM,
2266
- stopWidth: doorStopWidthM,
2267
- stopDepth: doorStopDepthM,
2268
- stopPositionZ: doorStopPositionZ,
2269
- centerZ: doorCenterZ,
2270
- material: doorMaterial,
2271
- setName: "1"
2272
- }), /*#__PURE__*/jsxRuntime.jsx(DoorStopCuts, {
2273
- visible: ["WDGF_WDG100", "WF_100", "WF_FLI"].includes(frameType),
2274
- width: doorWidthM,
2275
- height: totalOpeningHeightM,
2276
- stopWidth: secondDoorStopWidthM,
2277
- stopDepth: secondDoorStopDepthM,
2278
- stopPositionZ: secondDoorStopPositionZ,
2279
- centerZ: doorCenterZ,
2280
- material: doorMaterial,
2281
- setName: "2"
2282
- }), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
2283
- position: [occulusPositionXM, occulusPositionYM, 0],
2284
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2285
- args: [occulusWidthM, occulusHeightM, doorDepthM + 0.01]
2286
- })
2287
- })]
2288
- })
2289
- }), glassVisible && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2290
- children: [/*#__PURE__*/jsxRuntime.jsx("mesh", {
2291
- position: [0, 0, frontGlassOffsetZ],
2292
- castShadow: true,
2293
- material: glassInfillMaterial,
2294
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2295
- args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
2296
- })
2297
- }), !["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
2298
- position: [0, 0, backGlassOffsetZ],
2299
- castShadow: true,
2300
- material: glassInfillMaterial,
2301
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2302
- args: [doorWidthM, mainDoorHeightM, GlassPanelDepthM]
2303
- })
2304
- }), ["WDGF_WDG100", "WF_100"].includes(frameType) && /*#__PURE__*/jsxRuntime.jsx("mesh", {
2305
- position: [0, -secondDoorStopWidthM / 2, backGlassOffsetZ],
2306
- castShadow: true,
2307
- material: glassInfillMaterial,
2308
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2309
- args: [doorWidthM - 2 * secondDoorStopWidthM, mainDoorHeightM - secondDoorStopWidthM, GlassPanelDepthM]
2310
- })
2311
- })]
2312
- }), frontDoorPlane.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
2313
- position: [0, 0, doorDepthM / 2 + 0.0005],
2314
- castShadow: true,
2315
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
2316
- useGroups: true,
2317
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
2318
- material: frontDoorPlaneMaterial,
2319
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2320
- args: [doorWidthM, mainDoorHeightM, 0.001]
2321
- })
2322
- }), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
2323
- position: [occulusPositionXM, occulusPositionYM, 0],
2324
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2325
- args: [occulusWidthM, occulusHeightM, 0.002]
2326
- })
2327
- })]
2328
- })
2329
- }), backDoorPlane.visible && /*#__PURE__*/jsxRuntime.jsx("mesh", {
2330
- position: [0, 0, -doorDepthM / 2 - 0.0005],
2331
- castShadow: true,
2332
- children: /*#__PURE__*/jsxRuntime.jsxs(csg.Geometry, {
2333
- useGroups: true,
2334
- children: [/*#__PURE__*/jsxRuntime.jsx(csg.Base, {
2335
- material: backDoorPlaneMaterial,
2336
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2337
- args: [doorWidthM, mainDoorHeightM, 0.0001]
2338
- })
2339
- }), occulus.visible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx(csg.Subtraction, {
2340
- position: [occulusPositionXM, occulusPositionYM, 0],
2341
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2342
- args: [occulusWidthM, occulusHeightM, 0.002]
2343
- })
2344
- })]
2345
- })
2346
- }), occulus.visible && occulus.infillVisible && occulusWidthM > 0 && occulusHeightM > 0 && /*#__PURE__*/jsxRuntime.jsx("mesh", {
2347
- position: [occulusPositionXM, occulusPositionYM, 0],
2348
- castShadow: true,
2349
- material: occulusInfillMaterial,
2350
- children: /*#__PURE__*/jsxRuntime.jsx("boxGeometry", {
2351
- args: [occulusWidthM, occulusHeightM, occulusInfillDepthM]
2352
- })
2353
- }), /*#__PURE__*/jsxRuntime.jsx(DoorHandle, {
2354
- bodyType: bodyType,
2355
- handleX: handleX,
2356
- handleHeightM: handleHeightM,
2357
- doorDepthM: doorDepthM,
2358
- doorPivot: pivot
2359
- })]
2360
- })]
2361
- })]
2362
- });
2363
- }
2364
-
2365
- const DoorConfigurator = _ref => {
2366
- let {
2367
- doorName,
2368
- materials,
2369
- doorPivot,
2370
- doorOpening,
2371
- is2D = false,
2372
- totalWidth,
2373
- totalHeight,
2374
- totalDepth
2375
- } = _ref;
2376
- return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
2377
- initialIs2D: is2D,
2378
- totalWidth: totalWidth,
2379
- totalHeight: totalHeight,
2380
- totalDepth: totalDepth,
2381
- children: /*#__PURE__*/jsxRuntime.jsx(DoorModels, {
2382
- doorName: doorName,
2383
- materials: materials,
2384
- doorPivot: doorPivot,
2385
- doorOpening: doorOpening
2386
- })
2387
- });
2388
- };
2389
-
2390
- exports["default"] = DoorConfigurator;
2391
- exports.useConfigurator = useConfigurator;
2392
- //# sourceMappingURL=index.cjs.js.map