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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
8
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
-
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
var _excluded = ["width", "height", "state", "stateExtractor", "measurementUnit"];
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -40,6 +40,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
40
40
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
41
41
|
|
|
42
42
|
// utm tracking
|
|
43
|
+
_defineProperty(_this, "lastProcessedExternalEventId", null);
|
|
43
44
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
44
45
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
45
46
|
var utmRequestData = null;
|
|
@@ -120,12 +121,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
120
121
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
121
122
|
return _this;
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
-
// Toolbar control functions
|
|
125
124
|
_inherits(LiteKitchenConfigurator, _Component);
|
|
126
125
|
return _createClass(LiteKitchenConfigurator, [{
|
|
127
126
|
key: "setToolbar",
|
|
128
|
-
value:
|
|
127
|
+
value:
|
|
128
|
+
// Toolbar control functions
|
|
129
|
+
|
|
130
|
+
function setToolbar(toolBarKey) {
|
|
129
131
|
this.setState({
|
|
130
132
|
toolbar: toolBarKey
|
|
131
133
|
});
|
|
@@ -327,23 +329,40 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
327
329
|
});
|
|
328
330
|
}
|
|
329
331
|
}, {
|
|
330
|
-
key: "
|
|
331
|
-
value: function
|
|
332
|
-
var
|
|
333
|
-
|
|
334
|
-
projectActions = nextProps.projectActions,
|
|
335
|
-
catalog = nextProps.catalog,
|
|
336
|
-
externalEvent = nextProps.externalEvent,
|
|
337
|
-
onInternalEvent = nextProps.onInternalEvent;
|
|
332
|
+
key: "componentDidUpdate",
|
|
333
|
+
value: function componentDidUpdate(prevProps) {
|
|
334
|
+
var _this3 = this;
|
|
335
|
+
var ev = this.props.externalEvent;
|
|
338
336
|
|
|
339
|
-
//
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
337
|
+
// nothing new
|
|
338
|
+
if (!ev || ev === prevProps.externalEvent) return;
|
|
339
|
+
|
|
340
|
+
// must have id to ack
|
|
341
|
+
var eventId = ev.__eventId;
|
|
342
|
+
if (eventId == null) return;
|
|
343
|
+
|
|
344
|
+
// exactly-once guard
|
|
345
|
+
if (this.lastProcessedExternalEventId === eventId) return;
|
|
346
|
+
this.lastProcessedExternalEventId = eventId;
|
|
347
|
+
try {
|
|
348
|
+
var result = handleExternalEvent(this.props);
|
|
349
|
+
|
|
350
|
+
// if it returns a promise, ack after it resolves/rejects
|
|
351
|
+
if (result && typeof result.then === 'function') {
|
|
352
|
+
result["finally"](function () {
|
|
353
|
+
var _this3$props$onExtern, _this3$props;
|
|
354
|
+
(_this3$props$onExtern = (_this3$props = _this3.props).onExternalEventProcessed) === null || _this3$props$onExtern === void 0 || _this3$props$onExtern.call(_this3$props, eventId);
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
var _this$props$onExterna, _this$props2;
|
|
358
|
+
// sync case
|
|
359
|
+
(_this$props$onExterna = (_this$props2 = this.props).onExternalEventProcessed) === null || _this$props$onExterna === void 0 || _this$props$onExterna.call(_this$props2, eventId);
|
|
360
|
+
}
|
|
361
|
+
} catch (e) {
|
|
362
|
+
var _this$props$onExterna2, _this$props3;
|
|
363
|
+
// never deadlock the host queue
|
|
364
|
+
(_this$props$onExterna2 = (_this$props3 = this.props).onExternalEventProcessed) === null || _this$props$onExterna2 === void 0 || _this$props$onExterna2.call(_this$props3, eventId);
|
|
365
|
+
throw e;
|
|
347
366
|
}
|
|
348
367
|
}
|
|
349
368
|
}, {
|
|
@@ -357,12 +376,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
357
376
|
}, {
|
|
358
377
|
key: "render",
|
|
359
378
|
value: function render() {
|
|
360
|
-
var _this$
|
|
361
|
-
width = _this$
|
|
362
|
-
height = _this$
|
|
363
|
-
state = _this$
|
|
364
|
-
stateExtractor = _this$
|
|
365
|
-
|
|
379
|
+
var _this$props4 = this.props,
|
|
380
|
+
width = _this$props4.width,
|
|
381
|
+
height = _this$props4.height,
|
|
382
|
+
state = _this$props4.state,
|
|
383
|
+
stateExtractor = _this$props4.stateExtractor,
|
|
384
|
+
measurementUnit = _this$props4.measurementUnit,
|
|
385
|
+
props = _objectWithoutProperties(_this$props4, _excluded);
|
|
366
386
|
var _this$state = this.state,
|
|
367
387
|
savePopupVisible = _this$state.savePopupVisible,
|
|
368
388
|
quotePopupVisible = _this$state.quotePopupVisible,
|
|
@@ -408,7 +428,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
408
428
|
style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
|
|
409
429
|
height: height,
|
|
410
430
|
display: 'flex',
|
|
411
|
-
justifyContent: 'center'
|
|
431
|
+
justifyContent: 'center',
|
|
432
|
+
position: 'relative'
|
|
412
433
|
})
|
|
413
434
|
}, /*#__PURE__*/React.createElement(Content, _extends({
|
|
414
435
|
width: contentW,
|
|
@@ -443,7 +464,9 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
443
464
|
customContents: PropTypes.object,
|
|
444
465
|
softwareSignature: PropTypes.string,
|
|
445
466
|
configData: PropTypes.object,
|
|
446
|
-
onInternalEvent: PropTypes.func
|
|
467
|
+
onInternalEvent: PropTypes.func,
|
|
468
|
+
onExternalEventProcessed: PropTypes.func,
|
|
469
|
+
externalEvent: PropTypes.any
|
|
447
470
|
};
|
|
448
471
|
LiteKitchenConfigurator.contextTypes = {
|
|
449
472
|
store: PropTypes.object.isRequired
|
package/es/LiteRenderer.js
CHANGED
|
@@ -7,7 +7,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
-
var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "
|
|
10
|
+
var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "externalEvent", "onInternalEvent", "onExternalEventProcessed", "onError"];
|
|
11
11
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
@@ -144,10 +144,9 @@ export default function LiteRenderer(props) {
|
|
|
144
144
|
user = props.user,
|
|
145
145
|
auth = props.auth,
|
|
146
146
|
featureFlags = props.featureFlags,
|
|
147
|
-
sentry = props.sentry,
|
|
148
|
-
analytics = props.analytics,
|
|
149
147
|
externalEvent = props.externalEvent,
|
|
150
148
|
onInternalEvent = props.onInternalEvent,
|
|
149
|
+
onExternalEventProcessed = props.onExternalEventProcessed,
|
|
151
150
|
onError = props.onError,
|
|
152
151
|
passThrough = _objectWithoutProperties(props, _excluded);
|
|
153
152
|
|
|
@@ -298,7 +297,8 @@ export default function LiteRenderer(props) {
|
|
|
298
297
|
},
|
|
299
298
|
configData: configData,
|
|
300
299
|
externalEvent: externalEvent,
|
|
301
|
-
onInternalEvent: onInternalEvent
|
|
300
|
+
onInternalEvent: onInternalEvent,
|
|
301
|
+
onExternalEventProcessed: onExternalEventProcessed
|
|
302
302
|
}, passThrough)))));
|
|
303
303
|
}
|
|
304
304
|
|
|
@@ -315,12 +315,9 @@ LiteRenderer.propTypes = {
|
|
|
315
315
|
user: PropTypes.object,
|
|
316
316
|
auth: PropTypes.object,
|
|
317
317
|
featureFlags: PropTypes.object,
|
|
318
|
-
sentry: PropTypes.shape({
|
|
319
|
-
dsn: PropTypes.string,
|
|
320
|
-
environment: PropTypes.string
|
|
321
|
-
}),
|
|
322
318
|
externalEvent: PropTypes.object,
|
|
323
319
|
onInternalEvent: PropTypes.func,
|
|
324
320
|
onError: PropTypes.func,
|
|
321
|
+
onExternalEventProcessed: PropTypes.func,
|
|
325
322
|
store: PropTypes.object
|
|
326
323
|
};
|
|
@@ -13,12 +13,14 @@ export function selectToolDrawingLine(sceneComponentType) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export function beginDrawingLine(layerID, x, y, snapMask) {
|
|
16
|
+
var onInternalEvent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
16
17
|
return {
|
|
17
18
|
type: BEGIN_DRAWING_LINE,
|
|
18
19
|
layerID: layerID,
|
|
19
20
|
x: x,
|
|
20
21
|
y: y,
|
|
21
|
-
snapMask: snapMask
|
|
22
|
+
snapMask: snapMask,
|
|
23
|
+
onInternalEvent: onInternalEvent
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
export function updateDrawingLine(x, y, relatedLines, snapMask) {
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as Three from
|
|
2
|
-
import { Box3, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, RepeatWrapping, Shape, TextureLoader, Vector2 } from
|
|
1
|
+
import * as Three from "three";
|
|
2
|
+
import { Box3, Mesh, MeshBasicMaterial, MeshPhysicalMaterial, RepeatWrapping, Shape, TextureLoader, Vector2 } from "three";
|
|
3
3
|
import * as SharedStyle from "../../shared-style";
|
|
4
|
-
import { RGBELoader } from
|
|
4
|
+
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader";
|
|
5
5
|
var params = {
|
|
6
|
-
envMap:
|
|
6
|
+
envMap: "HDR",
|
|
7
7
|
roughness: 0.9,
|
|
8
8
|
metalness: 0.8,
|
|
9
9
|
exposure: 1.0
|
|
@@ -58,7 +58,7 @@ var assignUVs = function assignUVs(geometry) {
|
|
|
58
58
|
var y3 = position.getY(i + 2);
|
|
59
59
|
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);
|
|
60
60
|
}
|
|
61
|
-
geometry.setAttribute(
|
|
61
|
+
geometry.setAttribute("uv", new Three.BufferAttribute(new Float32Array(uvArray), 2));
|
|
62
62
|
geometry.needsUpdate = true;
|
|
63
63
|
};
|
|
64
64
|
export function createArea(element, layer, scene, textures) {
|
|
@@ -69,15 +69,15 @@ export function createArea(element, layer, scene, textures) {
|
|
|
69
69
|
var texture = element.texture;
|
|
70
70
|
texture.lengthRepeatScale = 0.01;
|
|
71
71
|
texture.heightRepeatScale = 0.01;
|
|
72
|
-
var color = element.properties.get(
|
|
72
|
+
var color = element.properties.get("patternColor");
|
|
73
73
|
if (element.selected) {
|
|
74
74
|
color = SharedStyle.AREA_MESH_COLOR.selected;
|
|
75
75
|
} else {
|
|
76
76
|
color = SharedStyle.AREA_MESH_COLOR.unselected;
|
|
77
77
|
}
|
|
78
|
-
if (texture.uri === undefined || texture.uri ==
|
|
78
|
+
if (texture.uri === undefined || texture.uri == "") {
|
|
79
79
|
// @todo THIS IS A TEMPORARY FIX TO HAVE A DEFAULT FLOOR TEXTURE
|
|
80
|
-
texture.uri = layer.floorStyle.uri ||
|
|
80
|
+
texture.uri = layer.floorStyle.uri || "https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg";
|
|
81
81
|
}
|
|
82
82
|
var shape = new Shape();
|
|
83
83
|
shape.moveTo(vertices[0].x, vertices[0].y);
|
|
@@ -85,7 +85,7 @@ export function createArea(element, layer, scene, textures) {
|
|
|
85
85
|
shape.lineTo(vertices[i].x, vertices[i].y);
|
|
86
86
|
}
|
|
87
87
|
function loadFloorENV() {
|
|
88
|
-
return new RGBELoader().load(
|
|
88
|
+
return new RGBELoader().load("/assets/Window.hdr", function (texture) {
|
|
89
89
|
texture.mapping = Three.EquirectangularReflectionMapping;
|
|
90
90
|
return texture;
|
|
91
91
|
});
|
|
@@ -105,8 +105,8 @@ export function createArea(element, layer, scene, textures) {
|
|
|
105
105
|
/* Create holes for the area */
|
|
106
106
|
element.holes.forEach(function (holeID) {
|
|
107
107
|
var holeCoords = [];
|
|
108
|
-
layer.getIn([
|
|
109
|
-
var _layer$getIn = layer.getIn([
|
|
108
|
+
layer.getIn(["areas", holeID, "vertices"]).forEach(function (vertexID) {
|
|
109
|
+
var _layer$getIn = layer.getIn(["vertices", vertexID]),
|
|
110
110
|
x = _layer$getIn.x,
|
|
111
111
|
y = _layer$getIn.y;
|
|
112
112
|
holeCoords.push([x, y]);
|
|
@@ -133,7 +133,7 @@ export function createArea(element, layer, scene, textures) {
|
|
|
133
133
|
var area = new Mesh(shapeGeometry, areaMaterial);
|
|
134
134
|
area.rotation.x -= Math.PI / 2;
|
|
135
135
|
area.receiveShadow = true;
|
|
136
|
-
area.name =
|
|
136
|
+
area.name = "floor";
|
|
137
137
|
// This mesh is use for creating ceiling mesh
|
|
138
138
|
|
|
139
139
|
var shapeGeometry2 = new Three.ShapeGeometry(shape);
|
|
@@ -144,7 +144,7 @@ export function createArea(element, layer, scene, textures) {
|
|
|
144
144
|
area2.castShadow = true;
|
|
145
145
|
area2.rotation.x -= Math.PI / 2;
|
|
146
146
|
area2.receiveShadow = true;
|
|
147
|
-
area2.name =
|
|
147
|
+
area2.name = "floorSupport";
|
|
148
148
|
var floorSupport = area2.clone();
|
|
149
149
|
area.userData.floorSupport = floorSupport;
|
|
150
150
|
return Promise.resolve(area);
|
|
@@ -154,13 +154,13 @@ export function updatedArea(element, layer, scene, textures, mesh, oldElement, d
|
|
|
154
154
|
selfDestroy();
|
|
155
155
|
return selfBuild();
|
|
156
156
|
};
|
|
157
|
-
var floor = mesh.getObjectByName(
|
|
157
|
+
var floor = mesh.getObjectByName("floor");
|
|
158
158
|
floor.receiveShadow = true;
|
|
159
|
-
if (differences[0] ==
|
|
159
|
+
if (differences[0] == "selected") {
|
|
160
160
|
var color = element.selected ? SharedStyle.AREA_MESH_COLOR.selected : SharedStyle.AREA_MESH_COLOR.unselected;
|
|
161
161
|
floor.material.color.set(color);
|
|
162
|
-
} else if (differences[0] ==
|
|
163
|
-
if (differences[1] ===
|
|
162
|
+
} else if (differences[0] == "properties") {
|
|
163
|
+
if (differences[1] === "texture") {
|
|
164
164
|
return noPerf();
|
|
165
165
|
}
|
|
166
166
|
} else return noPerf();
|
|
@@ -4,12 +4,12 @@ import { loadGLTF, scaleObject } from "../../utils/load-obj";
|
|
|
4
4
|
import { OBJTYPE_MESH } from "../../../constants";
|
|
5
5
|
var cached3DWindow = null;
|
|
6
6
|
export default {
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Window',
|
|
8
8
|
prototype: 'holes',
|
|
9
9
|
info: {
|
|
10
10
|
title: 'Clear',
|
|
11
11
|
tag: ['window'],
|
|
12
|
-
description: '
|
|
12
|
+
description: 'Window',
|
|
13
13
|
image: '/assets/img/svg/window/Clear.svg',
|
|
14
14
|
url: '/assets/gltf/window_clear.gltf'
|
|
15
15
|
},
|