kitchen-simulator 3.0.3 → 3.1.0-alpha.13
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/LiteKitchenConfigurator.js +52 -29
- package/es/LiteRenderer.js +5 -8
- package/es/actions/lines-actions.js +3 -1
- package/es/assets/img/png/helper/video_preview_start.png +0 -0
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/utils/item-loader.js +198 -197
- package/es/class/item.js +8 -0
- package/es/class/line.js +14 -2
- package/es/components/viewer2d/item.js +36 -12
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/viewer2d.js +12 -10
- package/es/components/viewer3d/viewer3d.js +66 -74
- package/es/constants.js +6 -2
- package/es/devLiteRenderer.js +192 -98
- package/es/index.js +104 -14
- package/es/reducers/lines-reducer.js +1 -1
- package/es/utils/geometry.js +161 -0
- package/es/utils/isolate-event-handler.js +268 -114
- package/es/utils/molding.js +234 -2
- package/lib/LiteKitchenConfigurator.js +52 -29
- package/lib/LiteRenderer.js +5 -8
- package/lib/actions/lines-actions.js +3 -1
- package/lib/assets/img/png/helper/video_preview_start.png +0 -0
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/utils/item-loader.js +195 -194
- package/lib/class/item.js +8 -0
- package/lib/class/line.js +13 -1
- package/lib/components/viewer2d/item.js +36 -12
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/viewer2d.js +12 -10
- package/lib/components/viewer3d/viewer3d.js +66 -74
- package/lib/constants.js +11 -7
- package/lib/devLiteRenderer.js +186 -92
- package/lib/index.js +104 -14
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/utils/geometry.js +162 -0
- package/lib/utils/isolate-event-handler.js +267 -113
- package/lib/utils/molding.js +233 -0
- package/package.json +1 -1
package/es/utils/molding.js
CHANGED
|
@@ -5,11 +5,11 @@ 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 { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
|
|
8
|
+
import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, 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
9
|
import * as Three from 'three';
|
|
10
10
|
import { convert } from "./convert-units-lite";
|
|
11
11
|
import IDBroker from "./id-broker";
|
|
12
|
-
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
12
|
+
import { getToeKickSKU, isEqualInstallationType, returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
13
13
|
import { GeometryUtils } from "./export";
|
|
14
14
|
import { isEmpty } from "./helper";
|
|
15
15
|
export function getItemRect(item) {
|
|
@@ -866,4 +866,236 @@ export function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
|
866
866
|
newMG.lines.reverse();
|
|
867
867
|
newMG = getMDPoints(newMG);
|
|
868
868
|
return newMG;
|
|
869
|
+
}
|
|
870
|
+
export function getMoldingDataOfScene(layer, catalog, doorStyle) {
|
|
871
|
+
var moldingData = [];
|
|
872
|
+
var items = layer.items.toArray();
|
|
873
|
+
var moldings = [];
|
|
874
|
+
// get all moldings info
|
|
875
|
+
items.forEach(function (itemCat) {
|
|
876
|
+
var _itemCat$molding;
|
|
877
|
+
itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
|
|
878
|
+
if (!moldings.some(function (m) {
|
|
879
|
+
return m.name === molding.name;
|
|
880
|
+
})) moldings.push(molding);
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
// calc normal molding
|
|
885
|
+
moldings.forEach(function (molding) {
|
|
886
|
+
var itemGroups = [];
|
|
887
|
+
var temp_items = [];
|
|
888
|
+
items.forEach(function (item) {
|
|
889
|
+
if (item.molding.some(function (mol) {
|
|
890
|
+
return mol.itemID === molding.itemID;
|
|
891
|
+
}) && isEnableItemForMolding(layer, item)) {
|
|
892
|
+
temp_items.push(item);
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
if (temp_items.length) {
|
|
896
|
+
while (temp_items.length > 0) {
|
|
897
|
+
var itemGroup = [temp_items[0]];
|
|
898
|
+
var _loop9 = function _loop9(_idx) {
|
|
899
|
+
if (!itemGroup.some(function (it) {
|
|
900
|
+
return it.id === temp_items[_idx].id;
|
|
901
|
+
}) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
|
|
902
|
+
itemGroup.push(temp_items[_idx]);
|
|
903
|
+
_idx = 0;
|
|
904
|
+
}
|
|
905
|
+
idx = _idx;
|
|
906
|
+
};
|
|
907
|
+
for (var idx = 0; idx < temp_items.length; idx++) {
|
|
908
|
+
_loop9(idx);
|
|
909
|
+
}
|
|
910
|
+
itemGroup.forEach(function (item) {
|
|
911
|
+
var index = temp_items.findIndex(function (it) {
|
|
912
|
+
return it.id === item.id;
|
|
913
|
+
});
|
|
914
|
+
if (index > -1) {
|
|
915
|
+
temp_items.splice(index, 1);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
itemGroups.push(itemGroup);
|
|
919
|
+
}
|
|
920
|
+
var molding_totalLength = 0;
|
|
921
|
+
itemGroups.forEach(function (itemgroup) {
|
|
922
|
+
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
923
|
+
var items = _toConsumableArray(itemgroup);
|
|
924
|
+
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
925
|
+
items = sortItemsByDistance(items, items[0]);
|
|
926
|
+
var _loop0 = function _loop0() {
|
|
927
|
+
var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
|
|
928
|
+
var temp_MGLines = [];
|
|
929
|
+
MGlines.forEach(function (line) {
|
|
930
|
+
var idx = itemLines.findIndex(function (itemLine) {
|
|
931
|
+
return isLinesOverlapped(line, itemLine);
|
|
932
|
+
});
|
|
933
|
+
var curItemLine = itemLines[idx];
|
|
934
|
+
if (idx > -1) {
|
|
935
|
+
if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
936
|
+
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
937
|
+
temp_MGLines.push(MGLine);
|
|
938
|
+
}
|
|
939
|
+
itemLines.splice(idx, 1);
|
|
940
|
+
} else {
|
|
941
|
+
temp_MGLines.push(line);
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
itemLines.forEach(function (itemLine) {
|
|
945
|
+
return temp_MGLines.push(itemLine);
|
|
946
|
+
});
|
|
947
|
+
MGlines = [].concat(temp_MGLines);
|
|
948
|
+
};
|
|
949
|
+
for (var i = 1; i < items.length; i++) {
|
|
950
|
+
_loop0();
|
|
951
|
+
}
|
|
952
|
+
MGlines.forEach(function (line) {
|
|
953
|
+
molding_totalLength += GeometryUtils.verticesDistance(line[0], line[1]);
|
|
954
|
+
});
|
|
955
|
+
});
|
|
956
|
+
molding_totalLength = convert(molding_totalLength).from('cm').to('in');
|
|
957
|
+
moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
|
|
958
|
+
doorStyle: doorStyle,
|
|
959
|
+
count: Math.ceil(molding_totalLength * 1.1 / 96)
|
|
960
|
+
}));
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
// calc toe kick molding
|
|
965
|
+
var tmp = [];
|
|
966
|
+
items.forEach(function (item) {
|
|
967
|
+
if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
|
|
968
|
+
tmp.push(item);
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
var tmpMoldingData = [];
|
|
972
|
+
var toedoorStyles = [];
|
|
973
|
+
tmp.map(function (item) {
|
|
974
|
+
var _item$molding;
|
|
975
|
+
if (item.layoutpos === BASE_CABINET_LAYOUTPOS && (isEmpty(item.molding) || ((_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.length) < 1 || !isEnableItemForMolding(layer, item))) {
|
|
976
|
+
var w = item.properties.get('width').get('_length');
|
|
977
|
+
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
978
|
+
w = convert(w / 2).from(wUnit).to('cm');
|
|
979
|
+
var h = item.properties.get('depth').get('_length');
|
|
980
|
+
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
981
|
+
h = convert(h / 2).from(hUnit).to('cm');
|
|
982
|
+
var outline = null;
|
|
983
|
+
var element = catalog.elements[item.get('type')];
|
|
984
|
+
if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
|
|
985
|
+
outline = element.info.outline;
|
|
986
|
+
var len = 0;
|
|
987
|
+
if (outline) {
|
|
988
|
+
// Extract Points from `outline`
|
|
989
|
+
var outlinePaths = outline.paths;
|
|
990
|
+
var outlineWidth = outline.svgWidth;
|
|
991
|
+
var outlineHeight = outline.svgHeight;
|
|
992
|
+
var outlinePoints = []; // Hold Points Of SVG
|
|
993
|
+
var _iterator3 = _createForOfIteratorHelper(outlinePaths),
|
|
994
|
+
_step3;
|
|
995
|
+
try {
|
|
996
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
997
|
+
var path = _step3.value;
|
|
998
|
+
var _iterator4 = _createForOfIteratorHelper(path.subPaths),
|
|
999
|
+
_step4;
|
|
1000
|
+
try {
|
|
1001
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1002
|
+
var subPath = _step4.value;
|
|
1003
|
+
outlinePoints = outlinePoints.concat(subPath.getPoints());
|
|
1004
|
+
}
|
|
1005
|
+
} catch (err) {
|
|
1006
|
+
_iterator4.e(err);
|
|
1007
|
+
} finally {
|
|
1008
|
+
_iterator4.f();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
} catch (err) {
|
|
1012
|
+
_iterator3.e(err);
|
|
1013
|
+
} finally {
|
|
1014
|
+
_iterator3.f();
|
|
1015
|
+
}
|
|
1016
|
+
var maxX = outlinePoints[0].x,
|
|
1017
|
+
minX = outlinePoints[0].x;
|
|
1018
|
+
var maxY = outlinePoints[0].y,
|
|
1019
|
+
minY = outlinePoints[0].y;
|
|
1020
|
+
outlinePoints.forEach(function (point) {
|
|
1021
|
+
if (point.x > maxX) {
|
|
1022
|
+
maxX = point.x;
|
|
1023
|
+
}
|
|
1024
|
+
if (point.x < minX) {
|
|
1025
|
+
minX = point.x;
|
|
1026
|
+
}
|
|
1027
|
+
if (point.y > maxY) {
|
|
1028
|
+
maxY = point.y;
|
|
1029
|
+
}
|
|
1030
|
+
if (point.y < minY) {
|
|
1031
|
+
minY = point.y;
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
outlinePoints.forEach(function (point) {
|
|
1035
|
+
if (GeometryUtils.isPointInRect([{
|
|
1036
|
+
x: minX,
|
|
1037
|
+
y: minY
|
|
1038
|
+
}, {
|
|
1039
|
+
x: minX,
|
|
1040
|
+
y: maxY
|
|
1041
|
+
}, {
|
|
1042
|
+
x: maxX,
|
|
1043
|
+
y: maxY
|
|
1044
|
+
}, {
|
|
1045
|
+
x: maxX,
|
|
1046
|
+
y: minY
|
|
1047
|
+
}], point)) {
|
|
1048
|
+
if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
len = convert(len).from('cm').to('in');
|
|
1052
|
+
} else {
|
|
1053
|
+
w = convert(w * 2).from('cm').to('in');
|
|
1054
|
+
len += w;
|
|
1055
|
+
}
|
|
1056
|
+
var doorIndex = toedoorStyles.findIndex(function (a) {
|
|
1057
|
+
var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
|
|
1058
|
+
if (!iDS) return false;
|
|
1059
|
+
if (!iDS.hasOwnProperty('id')) {
|
|
1060
|
+
iDS = iDS.toJS();
|
|
1061
|
+
}
|
|
1062
|
+
return a.doorStyle.id === iDS.id && isEqualInstallationType(a.doorStyle, iDS);
|
|
1063
|
+
});
|
|
1064
|
+
if (doorIndex > -1) {
|
|
1065
|
+
toedoorStyles[doorIndex].totalLength += len;
|
|
1066
|
+
} else {
|
|
1067
|
+
toedoorStyles.push({
|
|
1068
|
+
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
|
|
1069
|
+
totalLength: len
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
toedoorStyles.forEach(function (doorStyle) {
|
|
1075
|
+
var skuName = getToeKickSKU(doorStyle.doorStyle, catalog);
|
|
1076
|
+
var thumbnail = skuName ? skuName : '';
|
|
1077
|
+
// moldings.forEach(molding => {
|
|
1078
|
+
// if (
|
|
1079
|
+
// molding.name ===
|
|
1080
|
+
// getToeKickSKU(
|
|
1081
|
+
// doorStyle.doorStyle,
|
|
1082
|
+
// catalog,
|
|
1083
|
+
// true
|
|
1084
|
+
// )
|
|
1085
|
+
// )
|
|
1086
|
+
// thumbnail = molding.thumbnail;
|
|
1087
|
+
// });
|
|
1088
|
+
|
|
1089
|
+
doorStyle.totalLength && tmpMoldingData.push({
|
|
1090
|
+
name: TOE_KICK_MOLDING,
|
|
1091
|
+
sku: getToeKickSKU(doorStyle.doorStyle, catalog),
|
|
1092
|
+
thumbnail: thumbnail,
|
|
1093
|
+
category: 'molding',
|
|
1094
|
+
type: 'cabinet',
|
|
1095
|
+
doorStyle: doorStyle.doorStyle,
|
|
1096
|
+
count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
|
|
1097
|
+
});
|
|
1098
|
+
});
|
|
1099
|
+
if (tmpMoldingData.length > 0) moldingData = [].concat(_toConsumableArray(moldingData), tmpMoldingData);
|
|
1100
|
+
return moldingData;
|
|
869
1101
|
}
|
|
@@ -9,12 +9,12 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _axios = _interopRequireDefault(require("axios"));
|
|
19
19
|
var _convertUnitsLite = require("./utils/convert-units-lite");
|
|
20
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -30,7 +30,7 @@ var _translator = _interopRequireDefault(require("./translator/translator"));
|
|
|
30
30
|
var _objectsUtils = require("./utils/objects-utils");
|
|
31
31
|
var _version = require("./version");
|
|
32
32
|
var _isolateEventHandler = require("./utils/isolate-event-handler");
|
|
33
|
-
var _excluded = ["width", "height", "state", "stateExtractor"];
|
|
33
|
+
var _excluded = ["width", "height", "state", "stateExtractor", "measurementUnit"];
|
|
34
34
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
35
35
|
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; }
|
|
36
36
|
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; }
|
|
@@ -49,6 +49,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
49
49
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
50
50
|
|
|
51
51
|
// utm tracking
|
|
52
|
+
(0, _defineProperty2["default"])(_this, "lastProcessedExternalEventId", null);
|
|
52
53
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
53
54
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
54
55
|
var utmRequestData = null;
|
|
@@ -129,12 +130,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
129
130
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
130
131
|
return _this;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
// Toolbar control functions
|
|
134
133
|
(0, _inherits2["default"])(LiteKitchenConfigurator, _Component);
|
|
135
134
|
return (0, _createClass2["default"])(LiteKitchenConfigurator, [{
|
|
136
135
|
key: "setToolbar",
|
|
137
|
-
value:
|
|
136
|
+
value:
|
|
137
|
+
// Toolbar control functions
|
|
138
|
+
|
|
139
|
+
function setToolbar(toolBarKey) {
|
|
138
140
|
this.setState({
|
|
139
141
|
toolbar: toolBarKey
|
|
140
142
|
});
|
|
@@ -336,23 +338,40 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
336
338
|
});
|
|
337
339
|
}
|
|
338
340
|
}, {
|
|
339
|
-
key: "
|
|
340
|
-
value: function
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
projectActions = nextProps.projectActions,
|
|
344
|
-
catalog = nextProps.catalog,
|
|
345
|
-
externalEvent = nextProps.externalEvent,
|
|
346
|
-
onInternalEvent = nextProps.onInternalEvent;
|
|
341
|
+
key: "componentDidUpdate",
|
|
342
|
+
value: function componentDidUpdate(prevProps) {
|
|
343
|
+
var _this3 = this;
|
|
344
|
+
var ev = this.props.externalEvent;
|
|
347
345
|
|
|
348
|
-
//
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
346
|
+
// nothing new
|
|
347
|
+
if (!ev || ev === prevProps.externalEvent) return;
|
|
348
|
+
|
|
349
|
+
// must have id to ack
|
|
350
|
+
var eventId = ev.__eventId;
|
|
351
|
+
if (eventId == null) return;
|
|
352
|
+
|
|
353
|
+
// exactly-once guard
|
|
354
|
+
if (this.lastProcessedExternalEventId === eventId) return;
|
|
355
|
+
this.lastProcessedExternalEventId = eventId;
|
|
356
|
+
try {
|
|
357
|
+
var result = (0, _isolateEventHandler.handleExternalEvent)(this.props);
|
|
358
|
+
|
|
359
|
+
// if it returns a promise, ack after it resolves/rejects
|
|
360
|
+
if (result && typeof result.then === 'function') {
|
|
361
|
+
result["finally"](function () {
|
|
362
|
+
var _this3$props$onExtern, _this3$props;
|
|
363
|
+
(_this3$props$onExtern = (_this3$props = _this3.props).onExternalEventProcessed) === null || _this3$props$onExtern === void 0 || _this3$props$onExtern.call(_this3$props, eventId);
|
|
364
|
+
});
|
|
365
|
+
} else {
|
|
366
|
+
var _this$props$onExterna, _this$props2;
|
|
367
|
+
// sync case
|
|
368
|
+
(_this$props$onExterna = (_this$props2 = this.props).onExternalEventProcessed) === null || _this$props$onExterna === void 0 || _this$props$onExterna.call(_this$props2, eventId);
|
|
369
|
+
}
|
|
370
|
+
} catch (e) {
|
|
371
|
+
var _this$props$onExterna2, _this$props3;
|
|
372
|
+
// never deadlock the host queue
|
|
373
|
+
(_this$props$onExterna2 = (_this$props3 = this.props).onExternalEventProcessed) === null || _this$props$onExterna2 === void 0 || _this$props$onExterna2.call(_this$props3, eventId);
|
|
374
|
+
throw e;
|
|
356
375
|
}
|
|
357
376
|
}
|
|
358
377
|
}, {
|
|
@@ -366,12 +385,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
366
385
|
}, {
|
|
367
386
|
key: "render",
|
|
368
387
|
value: function render() {
|
|
369
|
-
var _this$
|
|
370
|
-
width = _this$
|
|
371
|
-
height = _this$
|
|
372
|
-
state = _this$
|
|
373
|
-
stateExtractor = _this$
|
|
374
|
-
|
|
388
|
+
var _this$props4 = this.props,
|
|
389
|
+
width = _this$props4.width,
|
|
390
|
+
height = _this$props4.height,
|
|
391
|
+
state = _this$props4.state,
|
|
392
|
+
stateExtractor = _this$props4.stateExtractor,
|
|
393
|
+
measurementUnit = _this$props4.measurementUnit,
|
|
394
|
+
props = (0, _objectWithoutProperties2["default"])(_this$props4, _excluded);
|
|
375
395
|
var _this$state = this.state,
|
|
376
396
|
savePopupVisible = _this$state.savePopupVisible,
|
|
377
397
|
quotePopupVisible = _this$state.quotePopupVisible,
|
|
@@ -417,7 +437,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
417
437
|
style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
|
|
418
438
|
height: height,
|
|
419
439
|
display: 'flex',
|
|
420
|
-
justifyContent: 'center'
|
|
440
|
+
justifyContent: 'center',
|
|
441
|
+
position: 'relative'
|
|
421
442
|
})
|
|
422
443
|
}, /*#__PURE__*/_react["default"].createElement(_export2.Content, (0, _extends2["default"])({
|
|
423
444
|
width: contentW,
|
|
@@ -452,7 +473,9 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
452
473
|
customContents: _propTypes["default"].object,
|
|
453
474
|
softwareSignature: _propTypes["default"].string,
|
|
454
475
|
configData: _propTypes["default"].object,
|
|
455
|
-
onInternalEvent: _propTypes["default"].func
|
|
476
|
+
onInternalEvent: _propTypes["default"].func,
|
|
477
|
+
onExternalEventProcessed: _propTypes["default"].func,
|
|
478
|
+
externalEvent: _propTypes["default"].any
|
|
456
479
|
};
|
|
457
480
|
LiteKitchenConfigurator.contextTypes = {
|
|
458
481
|
store: _propTypes["default"].object.isRequired
|
package/lib/LiteRenderer.js
CHANGED
|
@@ -35,7 +35,7 @@ var _immutable = require("immutable");
|
|
|
35
35
|
var Sentry = _interopRequireWildcard(require("@sentry/react"));
|
|
36
36
|
var THREE = _interopRequireWildcard(require("three"));
|
|
37
37
|
var _LiteKitchenConfigurator = _interopRequireDefault(require("./LiteKitchenConfigurator"));
|
|
38
|
-
var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "
|
|
38
|
+
var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "externalEvent", "onInternalEvent", "onExternalEventProcessed", "onError"];
|
|
39
39
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
40
40
|
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; }
|
|
41
41
|
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; }
|
|
@@ -153,10 +153,9 @@ function LiteRenderer(props) {
|
|
|
153
153
|
user = props.user,
|
|
154
154
|
auth = props.auth,
|
|
155
155
|
featureFlags = props.featureFlags,
|
|
156
|
-
sentry = props.sentry,
|
|
157
|
-
analytics = props.analytics,
|
|
158
156
|
externalEvent = props.externalEvent,
|
|
159
157
|
onInternalEvent = props.onInternalEvent,
|
|
158
|
+
onExternalEventProcessed = props.onExternalEventProcessed,
|
|
160
159
|
onError = props.onError,
|
|
161
160
|
passThrough = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
162
161
|
|
|
@@ -307,7 +306,8 @@ function LiteRenderer(props) {
|
|
|
307
306
|
},
|
|
308
307
|
configData: configData,
|
|
309
308
|
externalEvent: externalEvent,
|
|
310
|
-
onInternalEvent: onInternalEvent
|
|
309
|
+
onInternalEvent: onInternalEvent,
|
|
310
|
+
onExternalEventProcessed: onExternalEventProcessed
|
|
311
311
|
}, passThrough)))));
|
|
312
312
|
}
|
|
313
313
|
|
|
@@ -324,13 +324,10 @@ LiteRenderer.propTypes = {
|
|
|
324
324
|
user: _propTypes["default"].object,
|
|
325
325
|
auth: _propTypes["default"].object,
|
|
326
326
|
featureFlags: _propTypes["default"].object,
|
|
327
|
-
sentry: _propTypes["default"].shape({
|
|
328
|
-
dsn: _propTypes["default"].string,
|
|
329
|
-
environment: _propTypes["default"].string
|
|
330
|
-
}),
|
|
331
327
|
externalEvent: _propTypes["default"].object,
|
|
332
328
|
onInternalEvent: _propTypes["default"].func,
|
|
333
329
|
onError: _propTypes["default"].func,
|
|
330
|
+
onExternalEventProcessed: _propTypes["default"].func,
|
|
334
331
|
store: _propTypes["default"].object
|
|
335
332
|
};
|
|
336
333
|
module.exports = exports.default;
|
|
@@ -28,12 +28,14 @@ function selectToolDrawingLine(sceneComponentType) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function beginDrawingLine(layerID, x, y, snapMask) {
|
|
31
|
+
var onInternalEvent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
31
32
|
return {
|
|
32
33
|
type: _constants.BEGIN_DRAWING_LINE,
|
|
33
34
|
layerID: layerID,
|
|
34
35
|
x: x,
|
|
35
36
|
y: y,
|
|
36
|
-
snapMask: snapMask
|
|
37
|
+
snapMask: snapMask,
|
|
38
|
+
onInternalEvent: onInternalEvent
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
function updateDrawingLine(x, y, relatedLines, snapMask) {
|
|
Binary file
|
|
@@ -12,7 +12,7 @@ var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
|
|
|
12
12
|
var _RGBELoader = require("three/examples/jsm/loaders/RGBELoader");
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
14
|
var params = {
|
|
15
|
-
envMap:
|
|
15
|
+
envMap: "HDR",
|
|
16
16
|
roughness: 0.9,
|
|
17
17
|
metalness: 0.8,
|
|
18
18
|
exposure: 1.0
|
|
@@ -67,7 +67,7 @@ var assignUVs = function assignUVs(geometry) {
|
|
|
67
67
|
var y3 = position.getY(i + 2);
|
|
68
68
|
uvArray.push((x1 + offset.x) / range.x, (y1 + offset.y) / range.y, (x2 + offset.x) / range.x, (y2 + offset.y) / range.y, (x3 + offset.x) / range.x, (y3 + offset.y) / range.y);
|
|
69
69
|
}
|
|
70
|
-
geometry.setAttribute(
|
|
70
|
+
geometry.setAttribute("uv", new Three.BufferAttribute(new Float32Array(uvArray), 2));
|
|
71
71
|
geometry.needsUpdate = true;
|
|
72
72
|
};
|
|
73
73
|
function createArea(element, layer, scene, textures) {
|
|
@@ -78,15 +78,15 @@ function createArea(element, layer, scene, textures) {
|
|
|
78
78
|
var texture = element.texture;
|
|
79
79
|
texture.lengthRepeatScale = 0.01;
|
|
80
80
|
texture.heightRepeatScale = 0.01;
|
|
81
|
-
var color = element.properties.get(
|
|
81
|
+
var color = element.properties.get("patternColor");
|
|
82
82
|
if (element.selected) {
|
|
83
83
|
color = SharedStyle.AREA_MESH_COLOR.selected;
|
|
84
84
|
} else {
|
|
85
85
|
color = SharedStyle.AREA_MESH_COLOR.unselected;
|
|
86
86
|
}
|
|
87
|
-
if (texture.uri === undefined || texture.uri ==
|
|
87
|
+
if (texture.uri === undefined || texture.uri == "") {
|
|
88
88
|
// @todo THIS IS A TEMPORARY FIX TO HAVE A DEFAULT FLOOR TEXTURE
|
|
89
|
-
texture.uri = layer.floorStyle.uri ||
|
|
89
|
+
texture.uri = layer.floorStyle.uri || "https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg";
|
|
90
90
|
}
|
|
91
91
|
var shape = new _three.Shape();
|
|
92
92
|
shape.moveTo(vertices[0].x, vertices[0].y);
|
|
@@ -94,7 +94,7 @@ function createArea(element, layer, scene, textures) {
|
|
|
94
94
|
shape.lineTo(vertices[i].x, vertices[i].y);
|
|
95
95
|
}
|
|
96
96
|
function loadFloorENV() {
|
|
97
|
-
return new _RGBELoader.RGBELoader().load(
|
|
97
|
+
return new _RGBELoader.RGBELoader().load("/assets/Window.hdr", function (texture) {
|
|
98
98
|
texture.mapping = Three.EquirectangularReflectionMapping;
|
|
99
99
|
return texture;
|
|
100
100
|
});
|
|
@@ -114,8 +114,8 @@ function createArea(element, layer, scene, textures) {
|
|
|
114
114
|
/* Create holes for the area */
|
|
115
115
|
element.holes.forEach(function (holeID) {
|
|
116
116
|
var holeCoords = [];
|
|
117
|
-
layer.getIn([
|
|
118
|
-
var _layer$getIn = layer.getIn([
|
|
117
|
+
layer.getIn(["areas", holeID, "vertices"]).forEach(function (vertexID) {
|
|
118
|
+
var _layer$getIn = layer.getIn(["vertices", vertexID]),
|
|
119
119
|
x = _layer$getIn.x,
|
|
120
120
|
y = _layer$getIn.y;
|
|
121
121
|
holeCoords.push([x, y]);
|
|
@@ -142,7 +142,7 @@ function createArea(element, layer, scene, textures) {
|
|
|
142
142
|
var area = new _three.Mesh(shapeGeometry, areaMaterial);
|
|
143
143
|
area.rotation.x -= Math.PI / 2;
|
|
144
144
|
area.receiveShadow = true;
|
|
145
|
-
area.name =
|
|
145
|
+
area.name = "floor";
|
|
146
146
|
// This mesh is use for creating ceiling mesh
|
|
147
147
|
|
|
148
148
|
var shapeGeometry2 = new Three.ShapeGeometry(shape);
|
|
@@ -153,7 +153,7 @@ function createArea(element, layer, scene, textures) {
|
|
|
153
153
|
area2.castShadow = true;
|
|
154
154
|
area2.rotation.x -= Math.PI / 2;
|
|
155
155
|
area2.receiveShadow = true;
|
|
156
|
-
area2.name =
|
|
156
|
+
area2.name = "floorSupport";
|
|
157
157
|
var floorSupport = area2.clone();
|
|
158
158
|
area.userData.floorSupport = floorSupport;
|
|
159
159
|
return Promise.resolve(area);
|
|
@@ -163,13 +163,13 @@ function updatedArea(element, layer, scene, textures, mesh, oldElement, differen
|
|
|
163
163
|
selfDestroy();
|
|
164
164
|
return selfBuild();
|
|
165
165
|
};
|
|
166
|
-
var floor = mesh.getObjectByName(
|
|
166
|
+
var floor = mesh.getObjectByName("floor");
|
|
167
167
|
floor.receiveShadow = true;
|
|
168
|
-
if (differences[0] ==
|
|
168
|
+
if (differences[0] == "selected") {
|
|
169
169
|
var color = element.selected ? SharedStyle.AREA_MESH_COLOR.selected : SharedStyle.AREA_MESH_COLOR.unselected;
|
|
170
170
|
floor.material.color.set(color);
|
|
171
|
-
} else if (differences[0] ==
|
|
172
|
-
if (differences[1] ===
|
|
171
|
+
} else if (differences[0] == "properties") {
|
|
172
|
+
if (differences[1] === "texture") {
|
|
173
173
|
return noPerf();
|
|
174
174
|
}
|
|
175
175
|
} else return noPerf();
|
|
@@ -13,12 +13,12 @@ var _constants = require("../../../constants");
|
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
14
|
var cached3DWindow = null;
|
|
15
15
|
var _default = exports["default"] = {
|
|
16
|
-
name: '
|
|
16
|
+
name: 'Window',
|
|
17
17
|
prototype: 'holes',
|
|
18
18
|
info: {
|
|
19
19
|
title: 'Clear',
|
|
20
20
|
tag: ['window'],
|
|
21
|
-
description: '
|
|
21
|
+
description: 'Window',
|
|
22
22
|
image: '/assets/img/svg/window/Clear.svg',
|
|
23
23
|
url: '/assets/gltf/window_clear.gltf'
|
|
24
24
|
},
|