kitchen-simulator 7.0.8-react-18 → 7.0.10-react-18
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.
|
@@ -303,18 +303,19 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
303
303
|
}, {
|
|
304
304
|
key: "componentDidUpdate",
|
|
305
305
|
value: function componentDidUpdate(prevProps) {
|
|
306
|
-
var _extractedState$getIn2;
|
|
306
|
+
var _extractedState$getIn2, _extractedState$getIn3;
|
|
307
307
|
var _this$props2 = this.props,
|
|
308
308
|
externalEvent = _this$props2.externalEvent,
|
|
309
309
|
extractedState = _this$props2.extractedState,
|
|
310
310
|
projectActions = _this$props2.projectActions,
|
|
311
|
-
catalog = _this$props2.catalog
|
|
312
|
-
|
|
311
|
+
catalog = _this$props2.catalog,
|
|
312
|
+
onViewer2DChange = _this$props2.onViewer2DChange;
|
|
313
|
+
onViewer2DChange === null || onViewer2DChange === void 0 || onViewer2DChange(extractedState === null || extractedState === void 0 || (_extractedState$getIn2 = extractedState.getIn) === null || _extractedState$getIn2 === void 0 ? void 0 : _extractedState$getIn2.call(extractedState, ['viewer2D']).toJS());
|
|
313
314
|
// same behavior: handle external event when it changes
|
|
314
315
|
if (prevProps.externalEvent !== externalEvent) {
|
|
315
316
|
handleExternalEvent(this.props);
|
|
316
317
|
}
|
|
317
|
-
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$
|
|
318
|
+
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn3 = extractedState.getIn) === null || _extractedState$getIn3 === void 0 ? void 0 : _extractedState$getIn3.call(extractedState, ['catalog', 'ready']);
|
|
318
319
|
if (!catalogReady) projectActions.initCatalog(catalog);
|
|
319
320
|
}
|
|
320
321
|
}, {
|
package/es/LiteRenderer.js
CHANGED
|
@@ -6,7 +6,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
9
|
-
var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError"];
|
|
9
|
+
var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError", "onViewer2DChange"];
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
12
|
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; } } }; }
|
|
@@ -25,7 +25,6 @@ import * as THREE from 'three';
|
|
|
25
25
|
import * as Models from "./models";
|
|
26
26
|
import { State } from "./models";
|
|
27
27
|
import PlannerReducer from "./reducers/reducer";
|
|
28
|
-
import AppContext from "./AppContext";
|
|
29
28
|
import Catalog from "./catalog/catalog";
|
|
30
29
|
import * as Areas from "./catalog/areas/area/planner-element";
|
|
31
30
|
import * as Lines from "./catalog/lines/wall/planner-element";
|
|
@@ -164,6 +163,7 @@ export default function LiteRenderer(props) {
|
|
|
164
163
|
externalEvent = props.externalEvent,
|
|
165
164
|
onInternalEvent = props.onInternalEvent,
|
|
166
165
|
onError = props.onError,
|
|
166
|
+
onViewer2DChange = props.onViewer2DChange,
|
|
167
167
|
passThrough = _objectWithoutProperties(props, _excluded);
|
|
168
168
|
useEffect(function () {
|
|
169
169
|
return function () {
|
|
@@ -338,7 +338,8 @@ export default function LiteRenderer(props) {
|
|
|
338
338
|
},
|
|
339
339
|
configData: configData,
|
|
340
340
|
externalEvent: externalEvent,
|
|
341
|
-
onInternalEvent: onInternalEvent
|
|
341
|
+
onInternalEvent: onInternalEvent,
|
|
342
|
+
onViewer2DChange: onViewer2DChange
|
|
342
343
|
}, passThrough))));
|
|
343
344
|
}
|
|
344
345
|
LiteRenderer.propTypes = {
|
|
@@ -190,4 +190,8 @@ export var isWarningItem = function isWarningItem(item) {
|
|
|
190
190
|
if (item.category === 'cabinet') return !(item !== null && item !== void 0 && (_item$toJS$doorStyle = item.toJS().doorStyle) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.doorStyles) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.cds) !== null && _item$toJS$doorStyle !== void 0 && _item$toJS$doorStyle.filter(function (cd) {
|
|
191
191
|
return cd.itemID == (item === null || item === void 0 ? void 0 : item.getIn(['itemID']));
|
|
192
192
|
}).length) > 0;else return false;
|
|
193
|
-
};
|
|
193
|
+
};
|
|
194
|
+
export function shallowEqualViewer(a, b) {
|
|
195
|
+
if (!a || !b) return a === b;
|
|
196
|
+
return a.a === b.a && a.d === b.d && a.e === b.e && a.f === b.f && a.viewerWidth === b.viewerWidth && a.viewerHeight === b.viewerHeight && a.SVGWidth === b.SVGWidth && a.SVGHeight === b.SVGHeight;
|
|
197
|
+
}
|
package/es/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import React from 'react';
|
|
|
15
15
|
import * as Three from 'three';
|
|
16
16
|
import LiteRenderer from "./LiteRenderer";
|
|
17
17
|
import { createRoot } from 'react-dom/client';
|
|
18
|
+
import { shallowEqualViewer } from "./components/viewer2d/utils";
|
|
18
19
|
var ROOT_KEY = '__kitchenSimulatorRoot__';
|
|
19
20
|
var API_KEY = '__kitchenSimulatorApi__';
|
|
20
21
|
function nextFrame() {
|
|
@@ -368,6 +369,7 @@ export function renderKitchenSimulator(container) {
|
|
|
368
369
|
|
|
369
370
|
// ✅ Reuse root
|
|
370
371
|
var root = container[ROOT_KEY];
|
|
372
|
+
var latestViewer2D = null;
|
|
371
373
|
if (!root) {
|
|
372
374
|
root = createRoot(container);
|
|
373
375
|
container[ROOT_KEY] = root;
|
|
@@ -548,7 +550,12 @@ export function renderKitchenSimulator(container) {
|
|
|
548
550
|
key: "render",
|
|
549
551
|
value: function render() {
|
|
550
552
|
return /*#__PURE__*/React.createElement(LiteRenderer, _extends({}, this.props, {
|
|
551
|
-
externalEvent: this.state.externalEvent
|
|
553
|
+
externalEvent: this.state.externalEvent,
|
|
554
|
+
onViewer2DChange: function onViewer2DChange(v) {
|
|
555
|
+
if (!shallowEqualViewer(v, latestViewer2D)) {
|
|
556
|
+
latestViewer2D = v;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
552
559
|
}));
|
|
553
560
|
}
|
|
554
561
|
}]);
|
|
@@ -557,6 +564,9 @@ export function renderKitchenSimulator(container) {
|
|
|
557
564
|
__render: function __render(nextProps) {
|
|
558
565
|
root.render(/*#__PURE__*/React.createElement(Wrapper, nextProps));
|
|
559
566
|
},
|
|
567
|
+
getViewer2D: function getViewer2D() {
|
|
568
|
+
return latestViewer2D;
|
|
569
|
+
},
|
|
560
570
|
// ✅ host can query current inFlight
|
|
561
571
|
getGltfInFlight: function getGltfInFlight() {
|
|
562
572
|
return gltfTracker.getInFlight();
|