kitchen-simulator 4.3.8 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/class/item.js +1 -0
- package/es/components/viewer2d/viewer2d.js +4 -3
- package/es/components/viewer3d/viewer3d.js +3 -1
- package/es/constants.js +9 -1
- package/es/utils/helper.js +1 -1
- package/es/utils/isolate-event-handler.js +5 -0
- package/es/utils/molding.js +4 -3
- package/es/utils/skinPanelEngine.js +322 -0
- package/lib/class/item.js +1 -0
- package/lib/components/viewer2d/viewer2d.js +4 -3
- package/lib/components/viewer3d/viewer3d.js +3 -1
- package/lib/constants.js +11 -3
- package/lib/utils/isolate-event-handler.js +5 -0
- package/lib/utils/molding.js +4 -3
- package/lib/utils/skinPanelEngine.js +330 -0
- package/package.json +1 -1
package/es/class/item.js
CHANGED
|
@@ -1315,6 +1315,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
1315
1315
|
glossness: doorStyle.glossness,
|
|
1316
1316
|
name: doorStyle.name,
|
|
1317
1317
|
door_style_name: doorStyle.door_style_name,
|
|
1318
|
+
door_style_id: doorStyle.door_style_id,
|
|
1318
1319
|
texture: doorStyle.texture,
|
|
1319
1320
|
thumbnail: doorStyle.thumbnail,
|
|
1320
1321
|
type: doorStyle.type,
|
|
@@ -1410,9 +1410,10 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1410
1410
|
detectAutoPan: mode2DetectAutopan(mode),
|
|
1411
1411
|
onMouseDown: onMouseDown,
|
|
1412
1412
|
onMouseMove: onMouseMove,
|
|
1413
|
-
onMouseUp: onMouseUp
|
|
1414
|
-
miniaturePosition
|
|
1415
|
-
toolbarPosition
|
|
1413
|
+
onMouseUp: onMouseUp
|
|
1414
|
+
// miniaturePosition="none"
|
|
1415
|
+
// toolbarPosition="none"
|
|
1416
|
+
,
|
|
1416
1417
|
detectPinchGesture: false,
|
|
1417
1418
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1418
1419
|
ref: Viewer
|
|
@@ -1189,10 +1189,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1189
1189
|
};
|
|
1190
1190
|
var sendInternalEvent = function sendInternalEvent(evtType, evtElement) {
|
|
1191
1191
|
var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1192
|
+
var curLayerId = _this2.props.state.scene.selectedLayer;
|
|
1193
|
+
var curLayer = _this2.props.state.scene.getIn(['layers', curLayerId]);
|
|
1192
1194
|
if (!isEmpty(evtType) && !isEmpty(evtElement)) {
|
|
1193
1195
|
var _state$get, _this2$props$onIntern, _this2$props;
|
|
1194
1196
|
var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
|
|
1195
|
-
var payload = updatePayloadOfInternalEvent(evtElement,
|
|
1197
|
+
var payload = updatePayloadOfInternalEvent(evtElement, curLayer, catalog, pointArray);
|
|
1196
1198
|
(_this2$props$onIntern = (_this2$props = _this2.props).onInternalEvent) === null || _this2$props$onIntern === void 0 || _this2$props$onIntern.call(_this2$props, {
|
|
1197
1199
|
type: evtType,
|
|
1198
1200
|
value: payload
|
package/es/constants.js
CHANGED
|
@@ -770,4 +770,12 @@ export var ROOM_SHAPE_TYPE = {
|
|
|
770
770
|
};
|
|
771
771
|
export var DOORSTYLE_SCOPE_ALL = 'all';
|
|
772
772
|
export var DOORSTYLE_SCOPE_SINGLE = 'single';
|
|
773
|
-
export var DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
773
|
+
export var DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
774
|
+
|
|
775
|
+
// skin panel SKU
|
|
776
|
+
export var SKIN_SKU_BSV_24 = 'BSV24'; // 23.25" x 34.5" : For base cabinets
|
|
777
|
+
export var SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
778
|
+
export var SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
779
|
+
export var SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
780
|
+
export var SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
781
|
+
export var SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
package/es/utils/helper.js
CHANGED
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { HDRCubeTextureLoader } from 'three/examples/jsm/loaders/HDRCubeTextureLoader.js';
|
|
6
|
-
import { ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT, ANIMATE_STEP_MAX, DECIMAL_PLACES_2, HDR_URLS, MAX_ZOOM_IN_SCALE, MODE_ELEVATION_VIEW,
|
|
6
|
+
import { ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT, ANIMATE_STEP_MAX, DECIMAL_PLACES_2, HDR_URLS, MAX_ZOOM_IN_SCALE, MODE_ELEVATION_VIEW, UNIT_CENTIMETER, ZOOM_VARIABLE } from "../constants";
|
|
7
7
|
import * as Three from 'three';
|
|
8
8
|
import { isWarningItem, returnReplaceableDeepSearchType } from "./../components/viewer2d/utils";
|
|
9
9
|
import { convert } from "./convert-units-lite";
|
|
@@ -17,6 +17,7 @@ import { SVGLoader } from 'three/addons/loaders/SVGLoader';
|
|
|
17
17
|
import { getMoldingDataOfScene2 } from "./molding";
|
|
18
18
|
import { Scene, State } from "../models";
|
|
19
19
|
import { calcDistancesFromHoleToNearestOneOrWall } from "./geometry";
|
|
20
|
+
import { computeSkinPanels } from "./skinPanelEngine";
|
|
20
21
|
var PRECISION = 2;
|
|
21
22
|
|
|
22
23
|
// ---- compatibility: supports old + optimized props shapes ----
|
|
@@ -1607,6 +1608,10 @@ function _handleExternalEvent() {
|
|
|
1607
1608
|
sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
|
|
1608
1609
|
currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
|
|
1609
1610
|
sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture);
|
|
1611
|
+
|
|
1612
|
+
// get skin panel data
|
|
1613
|
+
sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer);
|
|
1614
|
+
|
|
1610
1615
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
1611
1616
|
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
1612
1617
|
type: INTERNAL_EVENT_SYNC_SCENE,
|
package/es/utils/molding.js
CHANGED
|
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
6
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
import { Map } from 'immutable';
|
|
8
9
|
import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, ITEM_TYPE, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOE_KICK_MOLDING, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
|
|
9
10
|
import * as Three from 'three';
|
|
10
11
|
import { convert } from "./convert-units-lite";
|
|
@@ -975,7 +976,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
975
976
|
MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
|
|
976
977
|
return moldingLines.push({
|
|
977
978
|
molding: _objectSpread({}, molding),
|
|
978
|
-
doorStyle: item.doorStyle
|
|
979
|
+
doorStyle: !isEmpty(item.doorStyle) && Map.isMap(item.doorStyle) ? item.doorStyle.toJS() : item.doorStyle,
|
|
979
980
|
line: line,
|
|
980
981
|
z: lineZ,
|
|
981
982
|
parentId: parentId,
|
|
@@ -997,7 +998,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
997
998
|
category: 'molding',
|
|
998
999
|
type: 'cabinet'
|
|
999
1000
|
},
|
|
1000
|
-
doorStyle: item.doorStyle
|
|
1001
|
+
doorStyle: !isEmpty(item.doorStyle) && Map.isMap(item.doorStyle) ? item.doorStyle.toJS() : item.doorStyle,
|
|
1001
1002
|
line: line,
|
|
1002
1003
|
z: z,
|
|
1003
1004
|
parentId: parentId,
|
|
@@ -1089,7 +1090,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1089
1090
|
});
|
|
1090
1091
|
// console.log('moldingLines: ', moldingLines);
|
|
1091
1092
|
|
|
1092
|
-
// make molding data with
|
|
1093
|
+
// make molding data with grouping molding & doorStyle
|
|
1093
1094
|
var _loop0 = function _loop0() {
|
|
1094
1095
|
var ml = moldingLines[k];
|
|
1095
1096
|
var mlLength = ml.molding.name === TOE_KICK_MOLDING ? ml.inchWidth : convert(GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
import { BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_LINK, OVERLAP_SOME, EPSILON, SKIN_SKU_BSV_24, SKIN_SKU_BSV_48, SKIN_SKU_WSV_1242, SKIN_SKU_WSV_2442, SKIN_SKU_WSV_2460, SKIN_SKU_USV245325 } from "../constants";
|
|
6
|
+
import { buildRectFromLines, getAllLines, pointsDistance, relationshipOfTwoOverlappedLines, rotatePointAroundPoint } from "./geometry";
|
|
7
|
+
import { MathUtils } from "./export";
|
|
8
|
+
import { convert } from "./convert-units-lite";
|
|
9
|
+
import { isEmpty } from "./helper";
|
|
10
|
+
function toCm(item, prop) {
|
|
11
|
+
var unit = item.properties.get(prop).get('_unit') || 'cm';
|
|
12
|
+
var value = item.properties.get(prop).get('_length');
|
|
13
|
+
return convert(value).from(unit).to('cm');
|
|
14
|
+
}
|
|
15
|
+
function toIn(cmValue) {
|
|
16
|
+
return MathUtils.toFixedFloat(convert(cmValue).from('cm').to('in'), 1);
|
|
17
|
+
}
|
|
18
|
+
function rotateCorner(pos, item, width, depth) {
|
|
19
|
+
return rotatePointAroundPoint(pos[0] * width / 2 + item.x, pos[1] * depth / 2 + item.y, item.x, item.y, item.rotation);
|
|
20
|
+
}
|
|
21
|
+
export function getSideFaces(item, layer) {
|
|
22
|
+
var sideFaces = [];
|
|
23
|
+
if (isEmpty(item)) return sideFaces;
|
|
24
|
+
var vertexLines = getAllLines(layer);
|
|
25
|
+
var rectLines = buildRectFromLines(layer, vertexLines);
|
|
26
|
+
var widthCm = toCm(item, 'width');
|
|
27
|
+
var depthCm = toCm(item, 'depth');
|
|
28
|
+
var heightCm = toCm(item, 'height');
|
|
29
|
+
var altitudeCm = toCm(item, 'altitude');
|
|
30
|
+
var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_SOME];
|
|
31
|
+
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
32
|
+
for (var i = 0; i < 4; i++) {
|
|
33
|
+
if (i === 0 || i === 2) continue; // only left & right
|
|
34
|
+
var isSnappedToWall = false;
|
|
35
|
+
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
36
|
+
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
37
|
+
var srcLine = {
|
|
38
|
+
x1: v0.x,
|
|
39
|
+
y1: v0.y,
|
|
40
|
+
x2: v1.x,
|
|
41
|
+
y2: v1.y
|
|
42
|
+
};
|
|
43
|
+
for (var j = 0; j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); j++) {
|
|
44
|
+
var destLine1 = {
|
|
45
|
+
x1: rectLines[j].rect[2].x,
|
|
46
|
+
y1: rectLines[j].rect[2].y,
|
|
47
|
+
x2: rectLines[j].rect[3].x,
|
|
48
|
+
y2: rectLines[j].rect[3].y
|
|
49
|
+
};
|
|
50
|
+
var destLine2 = {
|
|
51
|
+
x1: rectLines[j].rect[0].x,
|
|
52
|
+
y1: rectLines[j].rect[0].y,
|
|
53
|
+
x2: rectLines[j].rect[1].x,
|
|
54
|
+
y2: rectLines[j].rect[1].y
|
|
55
|
+
};
|
|
56
|
+
if (overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine2).result)) {
|
|
57
|
+
isSnappedToWall = true;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!isSnappedToWall) {
|
|
62
|
+
var depthInch = toIn(pointsDistance(srcLine.x1, srcLine.y1, srcLine.x2, srcLine.y2));
|
|
63
|
+
var heightInch = toIn(heightCm);
|
|
64
|
+
var skinPanelSKU = 'unknown';
|
|
65
|
+
switch (item.layoutpos) {
|
|
66
|
+
case BASE_CABINET_LAYOUTPOS:
|
|
67
|
+
skinPanelSKU = SKIN_SKU_BSV_24;
|
|
68
|
+
break;
|
|
69
|
+
case WALL_CABINET_LAYOUTPOS:
|
|
70
|
+
if (Math.abs(depthInch - 12) <= 1) skinPanelSKU = SKIN_SKU_WSV_1242;else if (Math.abs(depthInch - 24) <= 1) skinPanelSKU = SKIN_SKU_WSV_2442;
|
|
71
|
+
break;
|
|
72
|
+
case TALL_CABINET_LAYOUTPOS:
|
|
73
|
+
skinPanelSKU = SKIN_SKU_USV245325;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
sideFaces.push({
|
|
77
|
+
sectionLine: srcLine,
|
|
78
|
+
// cm unit
|
|
79
|
+
zBottom: altitudeCm,
|
|
80
|
+
// cm unit
|
|
81
|
+
zTop: altitudeCm + heightCm,
|
|
82
|
+
// cm unit
|
|
83
|
+
depth: depthInch,
|
|
84
|
+
// inch unit
|
|
85
|
+
height: heightInch,
|
|
86
|
+
// inch unit
|
|
87
|
+
skinPanelSKU: skinPanelSKU,
|
|
88
|
+
itemInfo: item.toJS()
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return sideFaces;
|
|
93
|
+
}
|
|
94
|
+
function collectLayerItems(layer) {
|
|
95
|
+
var _layer$items;
|
|
96
|
+
var skinLayouts = new Set([BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS]);
|
|
97
|
+
var skinPanelItems = [];
|
|
98
|
+
var otherItems = [];
|
|
99
|
+
layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
|
|
100
|
+
if (it.category === 'cabinet' && skinLayouts.has(it.layoutpos)) skinPanelItems.push(it);else otherItems.push(it);
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
skinPanelItems: skinPanelItems,
|
|
104
|
+
otherItems: otherItems
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function collectFaces(items, layer) {
|
|
108
|
+
var faces = [];
|
|
109
|
+
for (var i = 0; i < items.length; i++) {
|
|
110
|
+
var item = items[i];
|
|
111
|
+
var sideFaces = getSideFaces(item, layer);
|
|
112
|
+
faces = faces.concat(sideFaces);
|
|
113
|
+
}
|
|
114
|
+
return faces;
|
|
115
|
+
}
|
|
116
|
+
function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
117
|
+
var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME];
|
|
118
|
+
var removeIdxs = [];
|
|
119
|
+
for (var i = 0; i < sourceFaces.length; i++) {
|
|
120
|
+
var iFace = sourceFaces[i];
|
|
121
|
+
for (var j = 0; j < blockingFaces.length; j++) {
|
|
122
|
+
if (sourceFaces === blockingFaces && i === j) continue;
|
|
123
|
+
var jFace = blockingFaces[j];
|
|
124
|
+
if (overlapList.includes(relationshipOfTwoOverlappedLines(iFace.sectionLine, jFace.sectionLine).result)) {
|
|
125
|
+
var verticallyIncluded = (iFace.zBottom > jFace.zBottom || Math.abs(iFace.zBottom - jFace.zBottom) < EPSILON) && (iFace.zTop < jFace.zTop || Math.abs(iFace.zTop - jFace.zTop) < EPSILON);
|
|
126
|
+
if (verticallyIncluded) {
|
|
127
|
+
removeIdxs.push(i);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return sourceFaces.filter(function (face, idx) {
|
|
134
|
+
return !removeIdxs.includes(idx);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function applyGroupingRules(faces) {
|
|
138
|
+
var _applyHorizontalGroup = applyHorizontalGrouping(faces),
|
|
139
|
+
remainingAfterHorizontal = _applyHorizontalGroup.remainingAfterHorizontal,
|
|
140
|
+
horizontalGrouped = _applyHorizontalGroup.horizontalGrouped;
|
|
141
|
+
var _applyVerticalGroupin = applyVerticalGrouping(remainingAfterHorizontal),
|
|
142
|
+
remainingAfterVertical = _applyVerticalGroupin.remainingAfterVertical,
|
|
143
|
+
verticalGrouped = _applyVerticalGroupin.verticalGrouped;
|
|
144
|
+
return {
|
|
145
|
+
remainingFaces: remainingAfterVertical,
|
|
146
|
+
groupedFaces: [].concat(_toConsumableArray(horizontalGrouped), _toConsumableArray(verticalGrouped))
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Horizontal Grouping (for base cabinets back-to-back : BSV48 48" x 34.5")
|
|
152
|
+
*/
|
|
153
|
+
function applyHorizontalGrouping(faces) {
|
|
154
|
+
var removeIdxs = [];
|
|
155
|
+
var grouped = [];
|
|
156
|
+
for (var i = 0; i < faces.length; i++) {
|
|
157
|
+
var iFace = faces[i];
|
|
158
|
+
if (removeIdxs.includes(i) || iFace.itemInfo.layoutpos !== BASE_CABINET_LAYOUTPOS) continue;
|
|
159
|
+
for (var j = 0; j < faces.length; j++) {
|
|
160
|
+
if (i === j) continue;
|
|
161
|
+
var jFace = faces[j];
|
|
162
|
+
if (removeIdxs.includes(j) || jFace.itemInfo.layoutpos !== BASE_CABINET_LAYOUTPOS || Math.abs(iFace.zBottom - jFace.zBottom) > EPSILON || Math.abs(iFace.zTop - jFace.zTop) > EPSILON) continue;
|
|
163
|
+
var relationship = relationshipOfTwoOverlappedLines(iFace.sectionLine, jFace.sectionLine);
|
|
164
|
+
if (relationship.result === OVERLAP_LINK) {
|
|
165
|
+
grouped.push({
|
|
166
|
+
sectionLine: relationship.linkedLine,
|
|
167
|
+
// cm unit
|
|
168
|
+
zBottom: jFace.zBottom,
|
|
169
|
+
// cm unit
|
|
170
|
+
zTop: jFace.zTop,
|
|
171
|
+
// cm unit
|
|
172
|
+
depth: jFace.depth,
|
|
173
|
+
// inch unit
|
|
174
|
+
height: jFace.height,
|
|
175
|
+
// inch unit
|
|
176
|
+
skinPanelSKU: SKIN_SKU_BSV_48,
|
|
177
|
+
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
178
|
+
});
|
|
179
|
+
removeIdxs.push(i);
|
|
180
|
+
removeIdxs.push(j);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
remainingAfterHorizontal: faces.filter(function (f, idx) {
|
|
186
|
+
return !removeIdxs.includes(idx);
|
|
187
|
+
}),
|
|
188
|
+
horizontalGrouped: grouped
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Vertical Grouping (For CT3DR or CT2DR SKUs + stacked wall cabinets)
|
|
194
|
+
*/
|
|
195
|
+
function applyVerticalGrouping(faces) {
|
|
196
|
+
var removeIdxs = [];
|
|
197
|
+
var grouped = [];
|
|
198
|
+
for (var i = 0; i < faces.length; i++) {
|
|
199
|
+
var iFace = faces[i];
|
|
200
|
+
if (removeIdxs.includes(i) || iFace.itemInfo.layoutpos !== WALL_CABINET_LAYOUTPOS) continue;
|
|
201
|
+
for (var j = 0; j < faces.length; j++) {
|
|
202
|
+
if (i === j) continue;
|
|
203
|
+
var jFace = faces[j];
|
|
204
|
+
if (removeIdxs.includes(j) || jFace.itemInfo.layoutpos !== WALL_CABINET_LAYOUTPOS) continue;
|
|
205
|
+
var verticallyTouching = Math.abs(iFace.zBottom - jFace.zTop) < EPSILON || Math.abs(iFace.zTop - jFace.zBottom) < EPSILON;
|
|
206
|
+
var horizontallySame = relationshipOfTwoOverlappedLines(iFace.sectionLine, jFace.sectionLine).result === OVERLAP_SAME;
|
|
207
|
+
if (verticallyTouching && horizontallySame) {
|
|
208
|
+
grouped.push({
|
|
209
|
+
sectionLine: jFace.sectionLine,
|
|
210
|
+
// cm unit
|
|
211
|
+
zBottom: Math.min(jFace.zBottom, iFace.zBottom),
|
|
212
|
+
// cm unit
|
|
213
|
+
zTop: Math.max(jFace.zTop, iFace.zTop),
|
|
214
|
+
// cm unit
|
|
215
|
+
depth: jFace.depth,
|
|
216
|
+
// inch unit
|
|
217
|
+
height: jFace.height,
|
|
218
|
+
// inch unit
|
|
219
|
+
skinPanelSKU: SKIN_SKU_WSV_2460,
|
|
220
|
+
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
221
|
+
});
|
|
222
|
+
removeIdxs.push(i);
|
|
223
|
+
removeIdxs.push(j);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
remainingAfterVertical: faces.filter(function (f, idx) {
|
|
229
|
+
return !removeIdxs.includes(idx);
|
|
230
|
+
}),
|
|
231
|
+
verticalGrouped: grouped
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function isMP3TallCabinet(sku) {
|
|
235
|
+
return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Decide which skin panel pieces are needed for a tall cabinet.
|
|
240
|
+
*/
|
|
241
|
+
function resolveTallCabinetBundle(face) {
|
|
242
|
+
var item = face.itemInfo;
|
|
243
|
+
if (isMP3TallCabinet(item.sku_number)) {
|
|
244
|
+
return [SKIN_SKU_BSV_24, SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// fallback
|
|
248
|
+
return [SKIN_SKU_USV245325];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Converts a face → list of SKUs
|
|
253
|
+
*/
|
|
254
|
+
function resolveSkinPanelSKU(face) {
|
|
255
|
+
var layout = face.itemInfo.layoutpos;
|
|
256
|
+
if (layout === TALL_CABINET_LAYOUTPOS) {
|
|
257
|
+
return resolveTallCabinetBundle(face);
|
|
258
|
+
}
|
|
259
|
+
return [face.skinPanelSKU];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Make skin panel data with grouping skinPanelSKU & doorStyle
|
|
264
|
+
*/
|
|
265
|
+
function buildSkinPanelData(faces) {
|
|
266
|
+
var result = [];
|
|
267
|
+
var _loop = function _loop() {
|
|
268
|
+
var sf = faces[i];
|
|
269
|
+
var skus = resolveSkinPanelSKU(sf);
|
|
270
|
+
var _iterator = _createForOfIteratorHelper(skus),
|
|
271
|
+
_step;
|
|
272
|
+
try {
|
|
273
|
+
var _loop2 = function _loop2() {
|
|
274
|
+
var sku = _step.value;
|
|
275
|
+
var idx = result.findIndex(function (v) {
|
|
276
|
+
var _sf$itemInfo;
|
|
277
|
+
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id);
|
|
278
|
+
});
|
|
279
|
+
if (idx < 0) {
|
|
280
|
+
var _sf$itemInfo$doorStyl, _sf$itemInfo2, _sf$itemInfo$doorStyl2, _sf$itemInfo3;
|
|
281
|
+
result.push({
|
|
282
|
+
itemSKU: sku,
|
|
283
|
+
doorStyle: (_sf$itemInfo$doorStyl = (_sf$itemInfo2 = sf.itemInfo) === null || _sf$itemInfo2 === void 0 || (_sf$itemInfo2 = _sf$itemInfo2.doorStyle) === null || _sf$itemInfo2 === void 0 ? void 0 : _sf$itemInfo2.name) !== null && _sf$itemInfo$doorStyl !== void 0 ? _sf$itemInfo$doorStyl : '',
|
|
284
|
+
doorStyleId: (_sf$itemInfo$doorStyl2 = (_sf$itemInfo3 = sf.itemInfo) === null || _sf$itemInfo3 === void 0 || (_sf$itemInfo3 = _sf$itemInfo3.doorStyle) === null || _sf$itemInfo3 === void 0 ? void 0 : _sf$itemInfo3.id) !== null && _sf$itemInfo$doorStyl2 !== void 0 ? _sf$itemInfo$doorStyl2 : '',
|
|
285
|
+
installationType: 'standard',
|
|
286
|
+
quantity: 1
|
|
287
|
+
});
|
|
288
|
+
} else {
|
|
289
|
+
result[idx].quantity += 1;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
293
|
+
_loop2();
|
|
294
|
+
}
|
|
295
|
+
} catch (err) {
|
|
296
|
+
_iterator.e(err);
|
|
297
|
+
} finally {
|
|
298
|
+
_iterator.f();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
for (var i = 0; i < faces.length; i++) {
|
|
302
|
+
_loop();
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
export function computeSkinPanels(layer) {
|
|
307
|
+
// Get candidate skin panel items and other items
|
|
308
|
+
var _collectLayerItems = collectLayerItems(layer),
|
|
309
|
+
skinPanelItems = _collectLayerItems.skinPanelItems,
|
|
310
|
+
otherItems = _collectLayerItems.otherItems;
|
|
311
|
+
|
|
312
|
+
// Get all skin face list of [skinPanelItems] & [otherItems]
|
|
313
|
+
var skinFaces = collectFaces(skinPanelItems, layer);
|
|
314
|
+
var otherFaces = collectFaces(otherItems, layer);
|
|
315
|
+
skinFaces = filterFacesBlockedByFaces(skinFaces, skinFaces);
|
|
316
|
+
skinFaces = filterFacesBlockedByFaces(skinFaces, otherFaces);
|
|
317
|
+
var _applyGroupingRules = applyGroupingRules(skinFaces),
|
|
318
|
+
remainingFaces = _applyGroupingRules.remainingFaces,
|
|
319
|
+
groupedFaces = _applyGroupingRules.groupedFaces;
|
|
320
|
+
var finalFaces = [].concat(_toConsumableArray(remainingFaces), _toConsumableArray(groupedFaces));
|
|
321
|
+
return buildSkinPanelData(finalFaces);
|
|
322
|
+
}
|
package/lib/class/item.js
CHANGED
|
@@ -1322,6 +1322,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1322
1322
|
glossness: doorStyle.glossness,
|
|
1323
1323
|
name: doorStyle.name,
|
|
1324
1324
|
door_style_name: doorStyle.door_style_name,
|
|
1325
|
+
door_style_id: doorStyle.door_style_id,
|
|
1325
1326
|
texture: doorStyle.texture,
|
|
1326
1327
|
thumbnail: doorStyle.thumbnail,
|
|
1327
1328
|
type: doorStyle.type,
|
|
@@ -1419,9 +1419,10 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1419
1419
|
detectAutoPan: mode2DetectAutopan(mode),
|
|
1420
1420
|
onMouseDown: onMouseDown,
|
|
1421
1421
|
onMouseMove: onMouseMove,
|
|
1422
|
-
onMouseUp: onMouseUp
|
|
1423
|
-
miniaturePosition
|
|
1424
|
-
toolbarPosition
|
|
1422
|
+
onMouseUp: onMouseUp
|
|
1423
|
+
// miniaturePosition="none"
|
|
1424
|
+
// toolbarPosition="none"
|
|
1425
|
+
,
|
|
1425
1426
|
detectPinchGesture: false,
|
|
1426
1427
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1427
1428
|
ref: Viewer
|
|
@@ -1196,10 +1196,12 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1196
1196
|
};
|
|
1197
1197
|
var sendInternalEvent = function sendInternalEvent(evtType, evtElement) {
|
|
1198
1198
|
var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1199
|
+
var curLayerId = _this2.props.state.scene.selectedLayer;
|
|
1200
|
+
var curLayer = _this2.props.state.scene.getIn(['layers', curLayerId]);
|
|
1199
1201
|
if (!(0, _helper.isEmpty)(evtType) && !(0, _helper.isEmpty)(evtElement)) {
|
|
1200
1202
|
var _state$get, _this2$props$onIntern, _this2$props;
|
|
1201
1203
|
var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
|
|
1202
|
-
var payload = (0, _helper.updatePayloadOfInternalEvent)(evtElement,
|
|
1204
|
+
var payload = (0, _helper.updatePayloadOfInternalEvent)(evtElement, curLayer, catalog, pointArray);
|
|
1203
1205
|
(_this2$props$onIntern = (_this2$props = _this2.props).onInternalEvent) === null || _this2$props$onIntern === void 0 || _this2$props$onIntern.call(_this2$props, {
|
|
1204
1206
|
type: evtType,
|
|
1205
1207
|
value: payload
|
package/lib/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.END_DRAWING_LINE = exports.END_DRAWING_ITEM = exports.END_DRAWING_HOLE_3D = exports.END_DRAWING_HOLE = exports.END_DRAGGING_VERTEX = exports.END_DRAGGING_LINE = exports.END_DRAGGING_ITEM_3D = exports.END_DRAGGING_ITEM = exports.END_DRAGGING_HOLE_3D = exports.END_DRAGGING_HOLE = exports.END_CREATING_HOLE = exports.END_CREATING_CABINET = exports.ELEVATION_VIEW_TITLE = exports.ELEVATION_VIEW_RIGHT = exports.ELEVATION_VIEW_LEFT = exports.ELEVATION_VIEW_KEYWORD = exports.ELEVATION_VIEW_FRONT = exports.ELEVATION_VIEW_BACK = exports.ELEVATION_VIEW = exports.ELEMENT_VERTEX = exports.ELEMENT_LINE = exports.ELEMENT_ITEM = exports.ELEMENT_HOLE = exports.ELEMENT_AREA = exports.EDIT_WIDTH = exports.EDIT = exports.DUPLICATE_SELECTED = exports.DOORSTYLE_SCOPE_SINGLE = exports.DOORSTYLE_SCOPE_MULTIPLE = exports.DOORSTYLE_SCOPE_ALL = exports.DISTANCE_MEASUREMENT_LINE_COLOR = exports.DISTANCE_EPSILON = exports.DIFFERENT_VALUES_PATH_LENGTH = exports.DELTA = exports.DEFAULT_FONT_FAMILY = exports.DECIMAL_PLACES_3 = exports.DECIMAL_PLACES_2 = exports.DASH_LINE_COLOR = exports.CREATE_ROOM_WITH_SHAPE = exports.COPY_PROPERTIES = exports.CLIENTS_NAME = exports.CHANGE_WINDOW_DOOR_MEASURE = exports.CHANGE_WALL_LENGTH_MEASURE = exports.CHANGE_WALL_CABINET_MEASURE = exports.CHANGE_MEASUREMENT_UNIT = exports.CHANGE_CATALOG_PAGE = exports.CHANGE_BASE_CABINET_MEASURE = exports.CEIL_UNITS_LENGTH = exports.BROWN_COLOR = exports.BOTTOM_MOLDING_LOCATION = exports.BOTTOM = exports.BG_COLOR_OVERLAY = exports.BG_COLOR_HOVER = exports.BG_COLOR_1 = exports.BG_COLOR_0 = exports.BEGIN_UPLOADING_IMAGE = exports.BEGIN_ROTATING_ITEM_3D = exports.BEGIN_ROTATING_ITEM = exports.BEGIN_FITTING_IMAGE = exports.BEGIN_DRAWING_LINE = exports.BEGIN_DRAGGING_VERTEX = exports.BEGIN_DRAGGING_LINE = exports.BEGIN_DRAGGING_ITEM_3D = exports.BEGIN_DRAGGING_ITEM = exports.BEGIN_DRAGGING_HOLE_3D = exports.BEGIN_DRAGGING_HOLE = exports.BASE_ITEM_MEASUREMENT_LINE_COLOR = exports.BASE_CABINET_LAYOUTPOS = exports.BACK_DIST_ANG = exports.ATT_VERTEXT_TWO = exports.ATT_VERTEXT_ONE = exports.ATT_LINE_LENGTH = exports.ATT_ITEM_ROTATION = exports.ATT_ITEM_POS = exports.ATT_HOLE_OFFSET_B = exports.ATT_HOLE_OFFSET_A = exports.ARROW_TEXT_FORECOLOR = exports.ARROW_TEXT_FONTFACE = exports.ARROW_TEXT_BACKCOLOR = exports.ARROW_COLOR = exports.ARRAY_ELEVATION_VIEW_MODES = exports.ARRAY_3D_MODES = exports.AREA_ACTIONS = exports.API_SERVER_URL = exports.ANIMATE_STEP_MIN = exports.ANIMATE_STEP_MAX = exports.ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT = exports.ANIMATE_OBJECT = exports.ALTERATE_STATE = exports.ADD_VERTICAL_GUIDE = exports.ADD_TO_GROUP = exports.ADD_LAYER = exports.ADD_HORIZONTAL_GUIDE = exports.ADD_GROUP_FROM_SELECTED = exports.ADD_GROUP = exports.ADD_ELEMENT_TO_CATALOG = exports.ADD_CIRCULAR_GUIDE = exports.ADD_CABINETS = exports.ADD_APPLIANCES = exports.ACCENT_COLOR = void 0;
|
|
7
7
|
exports.MODE_DRAGGING_VERTEX = exports.MODE_DRAGGING_LINE = exports.MODE_DRAGGING_ITEM_3D = exports.MODE_DRAGGING_ITEM = exports.MODE_DRAGGING_HOLE_3D = exports.MODE_DRAGGING_HOLE = exports.MODE_CONFIGURING_PROJECT = exports.MODE_BACK_ELEVATION_VIEW = exports.MODE_3D_VIEW = exports.MODE_3D_FIRST_PERSON = exports.MODE_2D_ZOOM_OUT = exports.MODE_2D_ZOOM_IN = exports.MODE_2D_PAN = exports.MODE = exports.MIN_ANGLE_DISALLOW_DRAW_WALL = exports.MIDDLE_MOLDING_LOCATION = exports.MEPSILON = exports.MAX_ZOOM_IN_SCALE = exports.MAX_ANGLE_SCALE = exports.MAKE_FLOOR_PLAN = exports.LOGOUT = exports.LOGIN_SUCCESS = exports.LOGIN_ERROR = exports.LOCAL_STORAGE_TOKEN_VALUE = exports.LOCAL_STORAGE_TOKEN_NAME = exports.LOCAL_STORAGE_ORIGINAL_TOKEN = exports.LOCAL_STORAGE_CUSTOMER_INFO = exports.LOCAL_STORAGE_CART_ACTION = exports.LOAD_PROJECT = exports.LIST_QUANTITIES = exports.LIST_PARTS = exports.LINE_THICKNESS = exports.LINE_ACTIONS = exports.LEFT_DIST_ANG = exports.LEFT = exports.LABEL_COLOR = exports.KITCHEN_KONFIGURATOR = exports.KEYBOARD_BUTTON_CODE = exports.ITEM_TYPE = exports.ITEM_MOVE_UP = exports.ITEMS_ACTIONS = exports.INVERT = exports.INTERNAL_EVENT_UNSELECT_ALL = exports.INTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.INTERNAL_EVENT_SYNC_SCENE = exports.INTERNAL_EVENT_START_DRAW_WALL = exports.INTERNAL_EVENT_SELECT_ELEMENT = exports.INTERNAL_EVENT_ROTATE_ELEMENT = exports.INTERNAL_EVENT_REPLACE_CABINET = exports.INTERNAL_EVENT_ITEMS_CATALOG = exports.INTERNAL_EVENT_DRAW_ELEMENT = exports.INTERNAL_EVENT_DRAG_ELEMENT = exports.INSTALLATION_TYPE_SKU_SUFFIX = exports.INSTALLATION_TYPE_NAME = exports.INSTALLATION_SUFFIX_TYPE = exports.INIT_CATALOG = exports.HOLE_NAMES = exports.HOLE_ACTIONS = exports.HDR_URLS = exports.HAS_LOADINGBAR = exports.GROUP_TRANSLATE = exports.GROUP_ROTATE = exports.GROUP_ACTIONS = exports.GO_BACK_TO_CATALOG_PAGE = exports.FRONT_DIST_ANG = exports.FINISHING_TYPE = exports.FINISHING_TOUCH = exports.EXTERNAL_EVENT_ZOOM_OUT = exports.EXTERNAL_EVENT_ZOOM_IN = exports.EXTERNAL_EVENT_UPDATE_PROPERTY = exports.EXTERNAL_EVENT_UPDATE_ATTRIBUTE = exports.EXTERNAL_EVENT_UNDO = exports.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.EXTERNAL_EVENT_TOGGLE_TO_3D = exports.EXTERNAL_EVENT_TOGGLE_TO_2D = exports.EXTERNAL_EVENT_SYNC_SCENE = exports.EXTERNAL_EVENT_SET_MOLDING = exports.EXTERNAL_EVENT_SET_FINISHING = exports.EXTERNAL_EVENT_ROTATE_PAN = exports.EXTERNAL_EVENT_REPLACE_CABINET = exports.EXTERNAL_EVENT_REDO = exports.EXTERNAL_EVENT_PROJECT_SETTING = exports.EXTERNAL_EVENT_NEW_PROJECT = exports.EXTERNAL_EVENT_MOVE_PAN = exports.EXTERNAL_EVENT_LOAD_PROJECT = exports.EXTERNAL_EVENT_DUPLICATE_ELEMENT = exports.EXTERNAL_EVENT_DELETE_ELEMENT = exports.EXTERNAL_EVENT_CHANGE_DOORSTYLE = exports.EXTERNAL_EVENT_CENTERING_2D = exports.EXTERNAL_EVENT_ADD_WALL = exports.EXTERNAL_EVENT_ADD_ROOM_SHAPE = exports.EXTERNAL_EVENT_ADD_ITEM = exports.EXTERNAL_EVENT_ADD_HOLE = exports.ERROR_DATABASE = exports.EPSILON = exports.END_UPLOADING_IMAGE = exports.END_ROTATING_ITEM_3D = exports.END_ROTATING_ITEM = exports.END_LOADING = exports.END_FITTING_IMAGE = void 0;
|
|
8
8
|
exports.SET_BACKSPLASH_VISIBLE = exports.SET_BACKSPLASH = exports.SET_APPLIANCE_MATERIAL = exports.SELECT_TOOL_ZOOM_OUT = exports.SELECT_TOOL_ZOOM_IN = exports.SELECT_TOOL_UPLOAD_IMAGE = exports.SELECT_TOOL_PAN = exports.SELECT_TOOL_EDIT = exports.SELECT_TOOL_DRAWING_LINE = exports.SELECT_TOOL_DRAWING_ITEM_3D = exports.SELECT_TOOL_DRAWING_ITEM = exports.SELECT_TOOL_DRAWING_HOLE_3D = exports.SELECT_TOOL_DRAWING_HOLE = exports.SELECT_TOOL_3D_VIEW = exports.SELECT_TOOL_3D_FIRST_PERSON = exports.SELECT_LINE = exports.SELECT_LAYER = exports.SELECT_ITEM = exports.SELECT_HOLE = exports.SELECT_GROUP = exports.SELECT_DOOR_STYLE = exports.SELECT_AREA = exports.SELECT_ALL = exports.SELECTALL = exports.SECONDARY_PURPLE_COLOR = exports.SECONDARY_BLUE_COLOR = exports.SCENE_ACTIONS = exports.SAVE_PROJECT = exports.SAVE_DESIGN = exports.ROOM_SHAPE_TYPE = exports.ROOM_SHAPE_MEASUREMENT_LINE_COLOR = exports.ROOM_ELEMENT_MEASUREMENT_LINE_COLOR = exports.ROLLBACK = exports.RIGHT_DIST_ANG = exports.RIGHT = exports.REVIEW_AND_QUOTE = exports.REQUEST_ASSISTANCE = exports.REPLACE_SUBMODULE = exports.REPLACE_ITEM = exports.REMOVE_VERTICAL_GUIDE = exports.REMOVE_REPLACE_SUBMODULE = exports.REMOVE_LINEAR = exports.REMOVE_LAYER = exports.REMOVE_HORIZONTAL_GUIDE = exports.REMOVE_GROUP_AND_DELETE_ELEMENTS = exports.REMOVE_GROUP = exports.REMOVE_FROM_GROUP = exports.REMOVE_DRAWING_SUPPORT = exports.REMOVE_CIRCULAR_GUIDE = exports.REMOVE = exports.REDO = exports.RECREATE = exports.PUSH_LAST_SELECTED_CATALOG_ELEMENT_TO_HISTORY = exports.PROP_RESIZE_WIDTH = exports.PROP_RESIZE_HEIGHT = exports.PROP_RESIZE_DEPTH = exports.PROP_OPEN_DOORS = exports.PROP_FLIP_DOOR_HANDLE = exports.PROP_ALTITUDE = exports.PROJECT_SETTING_OPTION = exports.PROJECT_RE_NAME = exports.PROJECT_NAME_LENGTH_LIMIT = exports.PROJECT_ACTIONS = exports.PRODUCT = exports.PRIMARY_GREEN_COLOR = exports.PASTE_PROPERTIES = exports.OVERLAP_SOME = exports.OVERLAP_SAME = exports.OVERLAP_NONE = exports.OVERLAP_LINK = exports.OVERLAP_INCLUDED = exports.OPEN_PROJECT_CONFIGURATOR = exports.OPEN_CATALOG = exports.OBJTYPE_MESH = exports.OBJTYPE_GROUP = exports.NO_DATA_DATABASE = exports.NEW_PROJECT_BTN = exports.NEW_PROJECT = exports.NEW_DESIGN = exports.MOVE_COMPONENT = exports.MOLDING_LOCATIONS = exports.MODE_WAITING_DRAWING_LINE = exports.MODE_VIEWING_CATALOG = exports.MODE_UPLOADING_IMAGE = exports.MODE_SNAPPING = exports.MODE_ROTATING_ITEM_3D = exports.MODE_ROTATING_ITEM = exports.MODE_RIGHT_ELEVATION_VIEW = exports.MODE_LEFT_ELEVATION_VIEW = exports.MODE_IDLE_3D = exports.MODE_IDLE = exports.MODE_FRONT_VIEW = exports.MODE_FRONT_ELEVATION_VIEW = exports.MODE_FITTING_IMAGE = exports.MODE_ELEVATION_VIEW = exports.MODE_DRAWING_LINE = exports.MODE_DRAWING_ITEM_3D = exports.MODE_DRAWING_ITEM = exports.MODE_DRAWING_HOLE_3D = exports.MODE_DRAWING_HOLE = void 0;
|
|
9
|
-
exports.
|
|
10
|
-
exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = exports.UPDATE_DRAGGING_ITEM_CHANGED = exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = void 0;
|
|
9
|
+
exports.UPDATE_3D_CEIL_HEIGHT_UNIT = exports.UPDATE_3D_CEIL_HEIGHT = exports.UPDATE_2D_CAMERA = exports.UNSELECT_GROUP = exports.UNSELECT_ALL = exports.UNIT_MILLIMETER = exports.UNIT_MILE = exports.UNIT_METER = exports.UNIT_INCH_LONG = exports.UNIT_INCH = exports.UNIT_FOOT = exports.UNIT_CENTIMETER = exports.UNIT_ANGLE = exports.UNITS_LENGTH = exports.UNDO = exports.UNCREATE = exports.TWO_D_FLOOR_PLAN = exports.TOP_MOLDING_LOCATION = exports.TOP = exports.TOGGLE_SNAP = exports.TOGGLE_LOADING_CABINET = exports.TOE_KICK_MOLDING = exports.TITLE_SMALL_COLOR = exports.TITLE_COLOR = exports.THROW_WARNING = exports.THROW_ERROR = exports.TEXT_COLOR_NEUTRAL_7 = exports.TEXT_COLOR_NEUTRAL_6 = exports.TEXT_COLOR_NEUTRAL_5 = exports.TEXT_COLOR_NEUTRAL_4 = exports.TEXT_COLOR_NEUTRAL_3 = exports.TEXT_COLOR_NEUTRAL_2 = exports.TEXT_COLOR_NEUTRAL_1 = exports.TEXT_COLOR_NEUTRAL_0 = exports.TEXT_COLOR = exports.TECHNICAL_VIEW = exports.TALL_CABINET_LAYOUTPOS = exports.TAKE_PICTURE = exports.SUBTOTAL = exports.SUBMIT_REQUEST_ASSIST = exports.SUBMIT_DESIGN = exports.SUBMIT_ADD_CART = exports.STORE_DIST_ARRAY = exports.STOP_DRAWING_LINE = exports.STEP_CABINET_CHOOSE_PRODUCT = exports.STATUS_WARNING_LIGHT_COLOR = exports.STATUS_WARNING_COLOR = exports.STATUS_POSITIVE_LIGHT_COLOR = exports.STATUS_POSITIVE_COLOR = exports.STATUS_OVERDUE_LIGHT_COLOR = exports.STATUS_OVERDUE_COLOR = exports.STATUS_NEGATIVE_LIGHT_COLOR = exports.STATUS_NEGATIVE_COLOR = exports.STATUS_INFO_LIGHT_COLOR = exports.STATUS_INFO_COLOR = exports.SKIN_SKU_WSV_2460 = exports.SKIN_SKU_WSV_2442 = exports.SKIN_SKU_WSV_1242 = exports.SKIN_SKU_USV245325 = exports.SKIN_SKU_BSV_48 = exports.SKIN_SKU_BSV_24 = exports.SHIFT2DON = exports.SHIFT2DOFF = exports.SHAPE_SVG_WIDTH = exports.SHAPE_SVG_PADDING = exports.SHAPE_SVG_DEPTH = exports.SHADE_LIGHT_PURPLE_COLOR = exports.SHADE_LIGHT_GREEN_COLOR = exports.SHADE_LIGHT_BLUE_COLOR = exports.SHADE_DARK_PURPLE_COLOR = exports.SHADE_DARK_GREEN_COLOR = exports.SHADE_DARK_BLUE_COLOR = exports.SET_WALL_COLOR = exports.SET_USER_DATA = exports.SET_STATE_PROPERTIES = exports.SET_ROTATE_STATUS = exports.SET_RELATED_LINE = exports.SET_PROPERTIES = exports.SET_PROJECT_PROPERTIES = exports.SET_PROJECT_ID = exports.SET_MOVE_STATUS = exports.SET_MOLDING = exports.SET_MODELLING = exports.SET_MODE = exports.SET_LINES_ATTRIBUTES = exports.SET_LAYER_PROPERTIES = exports.SET_ITEMS_ATTRIBUTES = exports.SET_IS_HELP = exports.SET_IS_CABINET_DRAWING = exports.SET_INITIAL_DOOR_STYLE = exports.SET_HOLES_ATTRIBUTES = exports.SET_HANDLE_MATERIAL = exports.SET_GROUP_PROPERTIES = exports.SET_GROUP_BARYCENTER = exports.SET_GROUP_ATTRIBUTES = exports.SET_FLOOR_STYLES = exports.SET_DOOR_STYLE = exports.SET_DOOR_HANDLE = exports.SET_DISTANT = exports.SET_COUNTER_TOP = void 0;
|
|
10
|
+
exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = exports.UPDATE_DRAGGING_ITEM_CHANGED = exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = exports.UPDATE_DRAGGING_HOLE_RULER_CHANGED = exports.UPDATE_DRAGGING_HOLE_CHANGED = exports.UPDATE_DRAGGING_HOLE_3D = exports.UPDATE_DRAGGING_HOLE = exports.UPDATE_CEIL_HEIGHT_UNIT = exports.UPDATE_CEIL_HEIGHT = void 0;
|
|
11
11
|
//API server
|
|
12
12
|
// export const API_SERVER = 'http://localhost:3000/';
|
|
13
13
|
// ACTIONS project
|
|
@@ -780,4 +780,12 @@ var ROOM_SHAPE_TYPE = exports.ROOM_SHAPE_TYPE = {
|
|
|
780
780
|
};
|
|
781
781
|
var DOORSTYLE_SCOPE_ALL = exports.DOORSTYLE_SCOPE_ALL = 'all';
|
|
782
782
|
var DOORSTYLE_SCOPE_SINGLE = exports.DOORSTYLE_SCOPE_SINGLE = 'single';
|
|
783
|
-
var DOORSTYLE_SCOPE_MULTIPLE = exports.DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
783
|
+
var DOORSTYLE_SCOPE_MULTIPLE = exports.DOORSTYLE_SCOPE_MULTIPLE = 'multiple';
|
|
784
|
+
|
|
785
|
+
// skin panel SKU
|
|
786
|
+
var SKIN_SKU_BSV_24 = exports.SKIN_SKU_BSV_24 = 'BSV24'; // 23.25" x 34.5" : For base cabinets
|
|
787
|
+
var SKIN_SKU_BSV_48 = exports.SKIN_SKU_BSV_48 = 'BSV48'; // 48" x 34.5" : For base cabinets back-to-back or island backs
|
|
788
|
+
var SKIN_SKU_WSV_1242 = exports.SKIN_SKU_WSV_1242 = 'WSV1242'; // 11.25" x 42" : For 12" deep wall cabinets
|
|
789
|
+
var SKIN_SKU_WSV_2442 = exports.SKIN_SKU_WSV_2442 = 'WSV2442'; // 23.25" x 42" : For 24" deep wall cabinets
|
|
790
|
+
var SKIN_SKU_WSV_2460 = exports.SKIN_SKU_WSV_2460 = 'WSV2460'; // Usually used for CT3DR or CT2DR SKUs + stacked wall cabinets
|
|
791
|
+
var SKIN_SKU_USV245325 = exports.SKIN_SKU_USV245325 = 'USV2453.25'; // 23.25" x 53.25" : For tall cabinets
|
|
@@ -23,6 +23,7 @@ var _SVGLoader = require("three/addons/loaders/SVGLoader");
|
|
|
23
23
|
var _molding = require("./molding");
|
|
24
24
|
var _models = require("../models");
|
|
25
25
|
var _geometry = require("./geometry");
|
|
26
|
+
var _skinPanelEngine = require("./skinPanelEngine");
|
|
26
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
29
|
var PRECISION = 2;
|
|
@@ -1615,6 +1616,10 @@ function _handleExternalEvent() {
|
|
|
1615
1616
|
sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
|
|
1616
1617
|
currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
|
|
1617
1618
|
sceneData.layers[layerId].moldingData = (0, _molding.getMoldingDataOfScene2)(layer, props.catalog, currentTexture);
|
|
1619
|
+
|
|
1620
|
+
// get skin panel data
|
|
1621
|
+
sceneData.layers[layerId].skinPanelData = (0, _skinPanelEngine.computeSkinPanels)(layer);
|
|
1622
|
+
|
|
1618
1623
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
1619
1624
|
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
1620
1625
|
type: _constants.INTERNAL_EVENT_SYNC_SCENE,
|
package/lib/utils/molding.js
CHANGED
|
@@ -28,6 +28,7 @@ exports.sortItemsByDistance = sortItemsByDistance;
|
|
|
28
28
|
exports.tryMergeMDItem = tryMergeMDItem;
|
|
29
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
30
30
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
31
|
+
var _immutable = require("immutable");
|
|
31
32
|
var _constants = require("../constants");
|
|
32
33
|
var Three = _interopRequireWildcard(require("three"));
|
|
33
34
|
var _convertUnitsLite = require("./convert-units-lite");
|
|
@@ -1004,7 +1005,7 @@ function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1004
1005
|
MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
|
|
1005
1006
|
return moldingLines.push({
|
|
1006
1007
|
molding: _objectSpread({}, molding),
|
|
1007
|
-
doorStyle:
|
|
1008
|
+
doorStyle: !(0, _helper.isEmpty)(item.doorStyle) && _immutable.Map.isMap(item.doorStyle) ? item.doorStyle.toJS() : item.doorStyle,
|
|
1008
1009
|
line: line,
|
|
1009
1010
|
z: lineZ,
|
|
1010
1011
|
parentId: parentId,
|
|
@@ -1026,7 +1027,7 @@ function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1026
1027
|
category: 'molding',
|
|
1027
1028
|
type: 'cabinet'
|
|
1028
1029
|
},
|
|
1029
|
-
doorStyle:
|
|
1030
|
+
doorStyle: !(0, _helper.isEmpty)(item.doorStyle) && _immutable.Map.isMap(item.doorStyle) ? item.doorStyle.toJS() : item.doorStyle,
|
|
1030
1031
|
line: line,
|
|
1031
1032
|
z: z,
|
|
1032
1033
|
parentId: parentId,
|
|
@@ -1118,7 +1119,7 @@ function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1118
1119
|
});
|
|
1119
1120
|
// console.log('moldingLines: ', moldingLines);
|
|
1120
1121
|
|
|
1121
|
-
// make molding data with
|
|
1122
|
+
// make molding data with grouping molding & doorStyle
|
|
1122
1123
|
var _loop0 = function _loop0() {
|
|
1123
1124
|
var ml = moldingLines[k];
|
|
1124
1125
|
var mlLength = ml.molding.name === _constants.TOE_KICK_MOLDING ? ml.inchWidth : (0, _convertUnitsLite.convert)(_export.GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.computeSkinPanels = computeSkinPanels;
|
|
8
|
+
exports.getSideFaces = getSideFaces;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
var _geometry = require("./geometry");
|
|
12
|
+
var _export = require("./export");
|
|
13
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
14
|
+
var _helper = require("./helper");
|
|
15
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18
|
+
function toCm(item, prop) {
|
|
19
|
+
var unit = item.properties.get(prop).get('_unit') || 'cm';
|
|
20
|
+
var value = item.properties.get(prop).get('_length');
|
|
21
|
+
return (0, _convertUnitsLite.convert)(value).from(unit).to('cm');
|
|
22
|
+
}
|
|
23
|
+
function toIn(cmValue) {
|
|
24
|
+
return _export.MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(cmValue).from('cm').to('in'), 1);
|
|
25
|
+
}
|
|
26
|
+
function rotateCorner(pos, item, width, depth) {
|
|
27
|
+
return (0, _geometry.rotatePointAroundPoint)(pos[0] * width / 2 + item.x, pos[1] * depth / 2 + item.y, item.x, item.y, item.rotation);
|
|
28
|
+
}
|
|
29
|
+
function getSideFaces(item, layer) {
|
|
30
|
+
var sideFaces = [];
|
|
31
|
+
if ((0, _helper.isEmpty)(item)) return sideFaces;
|
|
32
|
+
var vertexLines = (0, _geometry.getAllLines)(layer);
|
|
33
|
+
var rectLines = (0, _geometry.buildRectFromLines)(layer, vertexLines);
|
|
34
|
+
var widthCm = toCm(item, 'width');
|
|
35
|
+
var depthCm = toCm(item, 'depth');
|
|
36
|
+
var heightCm = toCm(item, 'height');
|
|
37
|
+
var altitudeCm = toCm(item, 'altitude');
|
|
38
|
+
var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
|
|
39
|
+
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
40
|
+
for (var i = 0; i < 4; i++) {
|
|
41
|
+
if (i === 0 || i === 2) continue; // only left & right
|
|
42
|
+
var isSnappedToWall = false;
|
|
43
|
+
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
44
|
+
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
45
|
+
var srcLine = {
|
|
46
|
+
x1: v0.x,
|
|
47
|
+
y1: v0.y,
|
|
48
|
+
x2: v1.x,
|
|
49
|
+
y2: v1.y
|
|
50
|
+
};
|
|
51
|
+
for (var j = 0; j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); j++) {
|
|
52
|
+
var destLine1 = {
|
|
53
|
+
x1: rectLines[j].rect[2].x,
|
|
54
|
+
y1: rectLines[j].rect[2].y,
|
|
55
|
+
x2: rectLines[j].rect[3].x,
|
|
56
|
+
y2: rectLines[j].rect[3].y
|
|
57
|
+
};
|
|
58
|
+
var destLine2 = {
|
|
59
|
+
x1: rectLines[j].rect[0].x,
|
|
60
|
+
y1: rectLines[j].rect[0].y,
|
|
61
|
+
x2: rectLines[j].rect[1].x,
|
|
62
|
+
y2: rectLines[j].rect[1].y
|
|
63
|
+
};
|
|
64
|
+
if (overlapList.includes((0, _geometry.relationshipOfTwoOverlappedLines)(srcLine, destLine1).result) || overlapList.includes((0, _geometry.relationshipOfTwoOverlappedLines)(srcLine, destLine2).result)) {
|
|
65
|
+
isSnappedToWall = true;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!isSnappedToWall) {
|
|
70
|
+
var depthInch = toIn((0, _geometry.pointsDistance)(srcLine.x1, srcLine.y1, srcLine.x2, srcLine.y2));
|
|
71
|
+
var heightInch = toIn(heightCm);
|
|
72
|
+
var skinPanelSKU = 'unknown';
|
|
73
|
+
switch (item.layoutpos) {
|
|
74
|
+
case _constants.BASE_CABINET_LAYOUTPOS:
|
|
75
|
+
skinPanelSKU = _constants.SKIN_SKU_BSV_24;
|
|
76
|
+
break;
|
|
77
|
+
case _constants.WALL_CABINET_LAYOUTPOS:
|
|
78
|
+
if (Math.abs(depthInch - 12) <= 1) skinPanelSKU = _constants.SKIN_SKU_WSV_1242;else if (Math.abs(depthInch - 24) <= 1) skinPanelSKU = _constants.SKIN_SKU_WSV_2442;
|
|
79
|
+
break;
|
|
80
|
+
case _constants.TALL_CABINET_LAYOUTPOS:
|
|
81
|
+
skinPanelSKU = _constants.SKIN_SKU_USV245325;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
sideFaces.push({
|
|
85
|
+
sectionLine: srcLine,
|
|
86
|
+
// cm unit
|
|
87
|
+
zBottom: altitudeCm,
|
|
88
|
+
// cm unit
|
|
89
|
+
zTop: altitudeCm + heightCm,
|
|
90
|
+
// cm unit
|
|
91
|
+
depth: depthInch,
|
|
92
|
+
// inch unit
|
|
93
|
+
height: heightInch,
|
|
94
|
+
// inch unit
|
|
95
|
+
skinPanelSKU: skinPanelSKU,
|
|
96
|
+
itemInfo: item.toJS()
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return sideFaces;
|
|
101
|
+
}
|
|
102
|
+
function collectLayerItems(layer) {
|
|
103
|
+
var _layer$items;
|
|
104
|
+
var skinLayouts = new Set([_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
|
|
105
|
+
var skinPanelItems = [];
|
|
106
|
+
var otherItems = [];
|
|
107
|
+
layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
|
|
108
|
+
if (it.category === 'cabinet' && skinLayouts.has(it.layoutpos)) skinPanelItems.push(it);else otherItems.push(it);
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
skinPanelItems: skinPanelItems,
|
|
112
|
+
otherItems: otherItems
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function collectFaces(items, layer) {
|
|
116
|
+
var faces = [];
|
|
117
|
+
for (var i = 0; i < items.length; i++) {
|
|
118
|
+
var item = items[i];
|
|
119
|
+
var sideFaces = getSideFaces(item, layer);
|
|
120
|
+
faces = faces.concat(sideFaces);
|
|
121
|
+
}
|
|
122
|
+
return faces;
|
|
123
|
+
}
|
|
124
|
+
function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
125
|
+
var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME];
|
|
126
|
+
var removeIdxs = [];
|
|
127
|
+
for (var i = 0; i < sourceFaces.length; i++) {
|
|
128
|
+
var iFace = sourceFaces[i];
|
|
129
|
+
for (var j = 0; j < blockingFaces.length; j++) {
|
|
130
|
+
if (sourceFaces === blockingFaces && i === j) continue;
|
|
131
|
+
var jFace = blockingFaces[j];
|
|
132
|
+
if (overlapList.includes((0, _geometry.relationshipOfTwoOverlappedLines)(iFace.sectionLine, jFace.sectionLine).result)) {
|
|
133
|
+
var verticallyIncluded = (iFace.zBottom > jFace.zBottom || Math.abs(iFace.zBottom - jFace.zBottom) < _constants.EPSILON) && (iFace.zTop < jFace.zTop || Math.abs(iFace.zTop - jFace.zTop) < _constants.EPSILON);
|
|
134
|
+
if (verticallyIncluded) {
|
|
135
|
+
removeIdxs.push(i);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return sourceFaces.filter(function (face, idx) {
|
|
142
|
+
return !removeIdxs.includes(idx);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function applyGroupingRules(faces) {
|
|
146
|
+
var _applyHorizontalGroup = applyHorizontalGrouping(faces),
|
|
147
|
+
remainingAfterHorizontal = _applyHorizontalGroup.remainingAfterHorizontal,
|
|
148
|
+
horizontalGrouped = _applyHorizontalGroup.horizontalGrouped;
|
|
149
|
+
var _applyVerticalGroupin = applyVerticalGrouping(remainingAfterHorizontal),
|
|
150
|
+
remainingAfterVertical = _applyVerticalGroupin.remainingAfterVertical,
|
|
151
|
+
verticalGrouped = _applyVerticalGroupin.verticalGrouped;
|
|
152
|
+
return {
|
|
153
|
+
remainingFaces: remainingAfterVertical,
|
|
154
|
+
groupedFaces: [].concat((0, _toConsumableArray2["default"])(horizontalGrouped), (0, _toConsumableArray2["default"])(verticalGrouped))
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Horizontal Grouping (for base cabinets back-to-back : BSV48 48" x 34.5")
|
|
160
|
+
*/
|
|
161
|
+
function applyHorizontalGrouping(faces) {
|
|
162
|
+
var removeIdxs = [];
|
|
163
|
+
var grouped = [];
|
|
164
|
+
for (var i = 0; i < faces.length; i++) {
|
|
165
|
+
var iFace = faces[i];
|
|
166
|
+
if (removeIdxs.includes(i) || iFace.itemInfo.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) continue;
|
|
167
|
+
for (var j = 0; j < faces.length; j++) {
|
|
168
|
+
if (i === j) continue;
|
|
169
|
+
var jFace = faces[j];
|
|
170
|
+
if (removeIdxs.includes(j) || jFace.itemInfo.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS || Math.abs(iFace.zBottom - jFace.zBottom) > _constants.EPSILON || Math.abs(iFace.zTop - jFace.zTop) > _constants.EPSILON) continue;
|
|
171
|
+
var relationship = (0, _geometry.relationshipOfTwoOverlappedLines)(iFace.sectionLine, jFace.sectionLine);
|
|
172
|
+
if (relationship.result === _constants.OVERLAP_LINK) {
|
|
173
|
+
grouped.push({
|
|
174
|
+
sectionLine: relationship.linkedLine,
|
|
175
|
+
// cm unit
|
|
176
|
+
zBottom: jFace.zBottom,
|
|
177
|
+
// cm unit
|
|
178
|
+
zTop: jFace.zTop,
|
|
179
|
+
// cm unit
|
|
180
|
+
depth: jFace.depth,
|
|
181
|
+
// inch unit
|
|
182
|
+
height: jFace.height,
|
|
183
|
+
// inch unit
|
|
184
|
+
skinPanelSKU: _constants.SKIN_SKU_BSV_48,
|
|
185
|
+
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
186
|
+
});
|
|
187
|
+
removeIdxs.push(i);
|
|
188
|
+
removeIdxs.push(j);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
remainingAfterHorizontal: faces.filter(function (f, idx) {
|
|
194
|
+
return !removeIdxs.includes(idx);
|
|
195
|
+
}),
|
|
196
|
+
horizontalGrouped: grouped
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Vertical Grouping (For CT3DR or CT2DR SKUs + stacked wall cabinets)
|
|
202
|
+
*/
|
|
203
|
+
function applyVerticalGrouping(faces) {
|
|
204
|
+
var removeIdxs = [];
|
|
205
|
+
var grouped = [];
|
|
206
|
+
for (var i = 0; i < faces.length; i++) {
|
|
207
|
+
var iFace = faces[i];
|
|
208
|
+
if (removeIdxs.includes(i) || iFace.itemInfo.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) continue;
|
|
209
|
+
for (var j = 0; j < faces.length; j++) {
|
|
210
|
+
if (i === j) continue;
|
|
211
|
+
var jFace = faces[j];
|
|
212
|
+
if (removeIdxs.includes(j) || jFace.itemInfo.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) continue;
|
|
213
|
+
var verticallyTouching = Math.abs(iFace.zBottom - jFace.zTop) < _constants.EPSILON || Math.abs(iFace.zTop - jFace.zBottom) < _constants.EPSILON;
|
|
214
|
+
var horizontallySame = (0, _geometry.relationshipOfTwoOverlappedLines)(iFace.sectionLine, jFace.sectionLine).result === _constants.OVERLAP_SAME;
|
|
215
|
+
if (verticallyTouching && horizontallySame) {
|
|
216
|
+
grouped.push({
|
|
217
|
+
sectionLine: jFace.sectionLine,
|
|
218
|
+
// cm unit
|
|
219
|
+
zBottom: Math.min(jFace.zBottom, iFace.zBottom),
|
|
220
|
+
// cm unit
|
|
221
|
+
zTop: Math.max(jFace.zTop, iFace.zTop),
|
|
222
|
+
// cm unit
|
|
223
|
+
depth: jFace.depth,
|
|
224
|
+
// inch unit
|
|
225
|
+
height: jFace.height,
|
|
226
|
+
// inch unit
|
|
227
|
+
skinPanelSKU: _constants.SKIN_SKU_WSV_2460,
|
|
228
|
+
itemInfo: jFace.itemInfo // [TODO] how to select the doorstyle of grouped skin
|
|
229
|
+
});
|
|
230
|
+
removeIdxs.push(i);
|
|
231
|
+
removeIdxs.push(j);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
remainingAfterVertical: faces.filter(function (f, idx) {
|
|
237
|
+
return !removeIdxs.includes(idx);
|
|
238
|
+
}),
|
|
239
|
+
verticalGrouped: grouped
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function isMP3TallCabinet(sku) {
|
|
243
|
+
return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Decide which skin panel pieces are needed for a tall cabinet.
|
|
248
|
+
*/
|
|
249
|
+
function resolveTallCabinetBundle(face) {
|
|
250
|
+
var item = face.itemInfo;
|
|
251
|
+
if (isMP3TallCabinet(item.sku_number)) {
|
|
252
|
+
return [_constants.SKIN_SKU_BSV_24, _constants.SKIN_SKU_BSV_24, _constants.SKIN_SKU_WSV_2442];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// fallback
|
|
256
|
+
return [_constants.SKIN_SKU_USV245325];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Converts a face → list of SKUs
|
|
261
|
+
*/
|
|
262
|
+
function resolveSkinPanelSKU(face) {
|
|
263
|
+
var layout = face.itemInfo.layoutpos;
|
|
264
|
+
if (layout === _constants.TALL_CABINET_LAYOUTPOS) {
|
|
265
|
+
return resolveTallCabinetBundle(face);
|
|
266
|
+
}
|
|
267
|
+
return [face.skinPanelSKU];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Make skin panel data with grouping skinPanelSKU & doorStyle
|
|
272
|
+
*/
|
|
273
|
+
function buildSkinPanelData(faces) {
|
|
274
|
+
var result = [];
|
|
275
|
+
var _loop = function _loop() {
|
|
276
|
+
var sf = faces[i];
|
|
277
|
+
var skus = resolveSkinPanelSKU(sf);
|
|
278
|
+
var _iterator = _createForOfIteratorHelper(skus),
|
|
279
|
+
_step;
|
|
280
|
+
try {
|
|
281
|
+
var _loop2 = function _loop2() {
|
|
282
|
+
var sku = _step.value;
|
|
283
|
+
var idx = result.findIndex(function (v) {
|
|
284
|
+
var _sf$itemInfo;
|
|
285
|
+
return v.itemSKU === sku && v.doorStyleId === ((_sf$itemInfo = sf.itemInfo) === null || _sf$itemInfo === void 0 || (_sf$itemInfo = _sf$itemInfo.doorStyle) === null || _sf$itemInfo === void 0 ? void 0 : _sf$itemInfo.id);
|
|
286
|
+
});
|
|
287
|
+
if (idx < 0) {
|
|
288
|
+
var _sf$itemInfo$doorStyl, _sf$itemInfo2, _sf$itemInfo$doorStyl2, _sf$itemInfo3;
|
|
289
|
+
result.push({
|
|
290
|
+
itemSKU: sku,
|
|
291
|
+
doorStyle: (_sf$itemInfo$doorStyl = (_sf$itemInfo2 = sf.itemInfo) === null || _sf$itemInfo2 === void 0 || (_sf$itemInfo2 = _sf$itemInfo2.doorStyle) === null || _sf$itemInfo2 === void 0 ? void 0 : _sf$itemInfo2.name) !== null && _sf$itemInfo$doorStyl !== void 0 ? _sf$itemInfo$doorStyl : '',
|
|
292
|
+
doorStyleId: (_sf$itemInfo$doorStyl2 = (_sf$itemInfo3 = sf.itemInfo) === null || _sf$itemInfo3 === void 0 || (_sf$itemInfo3 = _sf$itemInfo3.doorStyle) === null || _sf$itemInfo3 === void 0 ? void 0 : _sf$itemInfo3.id) !== null && _sf$itemInfo$doorStyl2 !== void 0 ? _sf$itemInfo$doorStyl2 : '',
|
|
293
|
+
installationType: 'standard',
|
|
294
|
+
quantity: 1
|
|
295
|
+
});
|
|
296
|
+
} else {
|
|
297
|
+
result[idx].quantity += 1;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
301
|
+
_loop2();
|
|
302
|
+
}
|
|
303
|
+
} catch (err) {
|
|
304
|
+
_iterator.e(err);
|
|
305
|
+
} finally {
|
|
306
|
+
_iterator.f();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
for (var i = 0; i < faces.length; i++) {
|
|
310
|
+
_loop();
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
function computeSkinPanels(layer) {
|
|
315
|
+
// Get candidate skin panel items and other items
|
|
316
|
+
var _collectLayerItems = collectLayerItems(layer),
|
|
317
|
+
skinPanelItems = _collectLayerItems.skinPanelItems,
|
|
318
|
+
otherItems = _collectLayerItems.otherItems;
|
|
319
|
+
|
|
320
|
+
// Get all skin face list of [skinPanelItems] & [otherItems]
|
|
321
|
+
var skinFaces = collectFaces(skinPanelItems, layer);
|
|
322
|
+
var otherFaces = collectFaces(otherItems, layer);
|
|
323
|
+
skinFaces = filterFacesBlockedByFaces(skinFaces, skinFaces);
|
|
324
|
+
skinFaces = filterFacesBlockedByFaces(skinFaces, otherFaces);
|
|
325
|
+
var _applyGroupingRules = applyGroupingRules(skinFaces),
|
|
326
|
+
remainingFaces = _applyGroupingRules.remainingFaces,
|
|
327
|
+
groupedFaces = _applyGroupingRules.groupedFaces;
|
|
328
|
+
var finalFaces = [].concat((0, _toConsumableArray2["default"])(remainingFaces), (0, _toConsumableArray2["default"])(groupedFaces));
|
|
329
|
+
return buildSkinPanelData(finalFaces);
|
|
330
|
+
}
|