kitchen-simulator 7.0.1-react-18 → 7.0.4-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.
- package/es/WorkSpace.js +18 -846
- package/es/WorkSpaceHostMimic.js +164 -0
- package/es/WorkSpaceOriginal.js +845 -0
- package/es/index.js +2 -16
- package/es/utils/helper.js +6 -14
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -374,10 +374,6 @@ export function renderKitchenSimulator(container) {
|
|
|
374
374
|
}
|
|
375
375
|
var setExternalEventFn = null;
|
|
376
376
|
var destroyed = false;
|
|
377
|
-
var resolveReady = null;
|
|
378
|
-
var readyPromise = new Promise(function (res) {
|
|
379
|
-
return resolveReady = res;
|
|
380
|
-
});
|
|
381
377
|
var queue = [];
|
|
382
378
|
var pendingMarkers = new Set();
|
|
383
379
|
var MARKER = Symbol('marker');
|
|
@@ -533,8 +529,7 @@ export function renderKitchenSimulator(container) {
|
|
|
533
529
|
return _createClass(Wrapper, [{
|
|
534
530
|
key: "componentDidMount",
|
|
535
531
|
value: function componentDidMount() {
|
|
536
|
-
var _this3 = this
|
|
537
|
-
_resolveReady;
|
|
532
|
+
var _this3 = this;
|
|
538
533
|
this._mounted = true;
|
|
539
534
|
setExternalEventFn = function setExternalEventFn(newEvent) {
|
|
540
535
|
if (!_this3._mounted) return;
|
|
@@ -542,9 +537,6 @@ export function renderKitchenSimulator(container) {
|
|
|
542
537
|
externalEvent: newEvent
|
|
543
538
|
});
|
|
544
539
|
};
|
|
545
|
-
(_resolveReady = resolveReady) === null || _resolveReady === void 0 || _resolveReady();
|
|
546
|
-
resolveReady = null;
|
|
547
|
-
drain(); // now it can actually process queued events
|
|
548
540
|
}
|
|
549
541
|
}, {
|
|
550
542
|
key: "componentWillUnmount",
|
|
@@ -565,9 +557,6 @@ export function renderKitchenSimulator(container) {
|
|
|
565
557
|
__render: function __render(nextProps) {
|
|
566
558
|
root.render(/*#__PURE__*/React.createElement(Wrapper, nextProps));
|
|
567
559
|
},
|
|
568
|
-
whenReady: function whenReady() {
|
|
569
|
-
return readyPromise;
|
|
570
|
-
},
|
|
571
560
|
// ✅ host can query current inFlight
|
|
572
561
|
getGltfInFlight: function getGltfInFlight() {
|
|
573
562
|
return gltfTracker.getInFlight();
|
|
@@ -599,7 +588,7 @@ export function renderKitchenSimulator(container) {
|
|
|
599
588
|
__marker: MARKER,
|
|
600
589
|
token: token
|
|
601
590
|
});
|
|
602
|
-
|
|
591
|
+
drain();
|
|
603
592
|
|
|
604
593
|
// resolve when marker cleared
|
|
605
594
|
return new Promise(function (resolve) {
|
|
@@ -657,12 +646,9 @@ export function renderKitchenSimulator(container) {
|
|
|
657
646
|
pendingMarkers.clear();
|
|
658
647
|
},
|
|
659
648
|
unmount: function unmount() {
|
|
660
|
-
var _resolveReady2;
|
|
661
649
|
destroyed = true;
|
|
662
650
|
api.clearQueue();
|
|
663
651
|
gltfTracker.uninstall();
|
|
664
|
-
(_resolveReady2 = resolveReady) === null || _resolveReady2 === void 0 || _resolveReady2();
|
|
665
|
-
resolveReady = null;
|
|
666
652
|
var doUnmount = function doUnmount() {
|
|
667
653
|
try {
|
|
668
654
|
root.unmount();
|
package/es/utils/helper.js
CHANGED
|
@@ -341,20 +341,12 @@ export var updateViwer2D = function updateViwer2D(value) {
|
|
|
341
341
|
var _zoomValue = parseInt((value.a - 0.5) / ZOOM_VARIABLE);
|
|
342
342
|
if (_zoomValue > MAX_ZOOM_IN_SCALE) return;
|
|
343
343
|
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
value.e += 0.1;
|
|
351
|
-
}
|
|
352
|
-
while (!(value.f <= 80)) {
|
|
353
|
-
value.f -= 0.1;
|
|
354
|
-
}
|
|
355
|
-
while (!(value.f + value.a * value.SVGHeight + 10 >= value.viewerHeight)) {
|
|
356
|
-
value.f += 0.1;
|
|
357
|
-
}
|
|
344
|
+
var maxE = 10;
|
|
345
|
+
var minE = value.viewerWidth - (value.a * value.SVGWidth + 10);
|
|
346
|
+
value.e = Math.min(maxE, Math.max(minE, value.e));
|
|
347
|
+
var maxF = 80;
|
|
348
|
+
var minF = value.viewerHeight - (value.a * value.SVGHeight + 10);
|
|
349
|
+
value.f = Math.min(maxF, Math.max(minF, value.f));
|
|
358
350
|
if (viewer2DActions && compareSVGRect(value)) viewer2DActions.updateCameraView(value);
|
|
359
351
|
};
|
|
360
352
|
export function centering2D(state) {
|