zakeke-configurator-react 0.0.174 → 0.0.175
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/dist/index.js +70 -325
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43928,277 +43928,6 @@ var SceneHelper = /*#__PURE__*/function () {
|
|
|
43928
43928
|
|
|
43929
43929
|
/***/ }),
|
|
43930
43930
|
|
|
43931
|
-
/***/ "../../3D/src/Components/ScenePreview/ScenePreview.ts":
|
|
43932
|
-
/*!************************************************************!*\
|
|
43933
|
-
!*** ../../3D/src/Components/ScenePreview/ScenePreview.ts ***!
|
|
43934
|
-
\************************************************************/
|
|
43935
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
43936
|
-
|
|
43937
|
-
"use strict";
|
|
43938
|
-
__webpack_require__.r(__webpack_exports__);
|
|
43939
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
43940
|
-
/* harmony export */ "ScenePreviewData": () => (/* binding */ ScenePreviewData),
|
|
43941
|
-
/* harmony export */ "ScenesPreview": () => (/* binding */ ScenesPreview)
|
|
43942
|
-
/* harmony export */ });
|
|
43943
|
-
/* harmony import */ var _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Components/DesignManagers/MeshDesignManager */ "../../3D/src/Components/DesignManagers/MeshDesignManager.ts");
|
|
43944
|
-
/* harmony import */ var _SceneHelper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../SceneHelper */ "../../3D/src/Components/SceneHelper.ts");
|
|
43945
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
43946
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
43947
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43948
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
43949
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43950
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
43951
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
43952
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
43953
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
43954
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43955
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
43956
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
43957
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
43958
|
-
|
|
43959
|
-
|
|
43960
|
-
var ScenePreviewData = /*#__PURE__*/_createClass(function ScenePreviewData() {
|
|
43961
|
-
_classCallCheck(this, ScenePreviewData);
|
|
43962
|
-
});
|
|
43963
|
-
var ScenesPreview = /*#__PURE__*/function () {
|
|
43964
|
-
function ScenesPreview() {
|
|
43965
|
-
_classCallCheck(this, ScenesPreview);
|
|
43966
|
-
}
|
|
43967
|
-
_createClass(ScenesPreview, null, [{
|
|
43968
|
-
key: "getPreviewsAsync",
|
|
43969
|
-
value: function () {
|
|
43970
|
-
var _getPreviewsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(scene, rootUrl, options) {
|
|
43971
|
-
var previewMaker, previews;
|
|
43972
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43973
|
-
while (1) switch (_context.prev = _context.next) {
|
|
43974
|
-
case 0:
|
|
43975
|
-
previewMaker = new ScenePreviewMaker(scene, rootUrl, options);
|
|
43976
|
-
_context.next = 3;
|
|
43977
|
-
return previewMaker.getPreviewsAsync();
|
|
43978
|
-
case 3:
|
|
43979
|
-
previews = _context.sent;
|
|
43980
|
-
previewMaker.dispose();
|
|
43981
|
-
return _context.abrupt("return", previews);
|
|
43982
|
-
case 6:
|
|
43983
|
-
case "end":
|
|
43984
|
-
return _context.stop();
|
|
43985
|
-
}
|
|
43986
|
-
}, _callee);
|
|
43987
|
-
}));
|
|
43988
|
-
function getPreviewsAsync(_x, _x2, _x3) {
|
|
43989
|
-
return _getPreviewsAsync.apply(this, arguments);
|
|
43990
|
-
}
|
|
43991
|
-
return getPreviewsAsync;
|
|
43992
|
-
}()
|
|
43993
|
-
}]);
|
|
43994
|
-
return ScenesPreview;
|
|
43995
|
-
}();
|
|
43996
|
-
var ScenePreviewMaker = /*#__PURE__*/function () {
|
|
43997
|
-
function ScenePreviewMaker(scene, rootUrl, options) {
|
|
43998
|
-
_classCallCheck(this, ScenePreviewMaker);
|
|
43999
|
-
_defineProperty(this, "_rootUrl", "");
|
|
44000
|
-
_defineProperty(this, "_localEngine", null);
|
|
44001
|
-
_defineProperty(this, "_hostingScene", null);
|
|
44002
|
-
_defineProperty(this, "_hostingSceneHelper", null);
|
|
44003
|
-
this._scene = scene;
|
|
44004
|
-
this._rootUrl = rootUrl;
|
|
44005
|
-
this._options = options;
|
|
44006
|
-
}
|
|
44007
|
-
_createClass(ScenePreviewMaker, [{
|
|
44008
|
-
key: "dispose",
|
|
44009
|
-
value: function dispose() {
|
|
44010
|
-
this.disposeHostingScene();
|
|
44011
|
-
this.disposeLocalEngine();
|
|
44012
|
-
}
|
|
44013
|
-
}, {
|
|
44014
|
-
key: "createLocalEngine",
|
|
44015
|
-
value: function createLocalEngine() {
|
|
44016
|
-
if (!this._localEngine) {
|
|
44017
|
-
var localCanvas = document.createElement('canvas');
|
|
44018
|
-
localCanvas.id = "ScenePreviewCanvas";
|
|
44019
|
-
localCanvas.width = this._options.width || 1024;
|
|
44020
|
-
localCanvas.height = this._options.height || 1024;
|
|
44021
|
-
this._localEngine = new BABYLON.Engine(localCanvas, true, {
|
|
44022
|
-
premultipliedAlpha: false,
|
|
44023
|
-
preserveDrawingBuffer: true
|
|
44024
|
-
});
|
|
44025
|
-
this._localEngine.setSize(localCanvas.width, localCanvas.height);
|
|
44026
|
-
this._localEngine.displayLoadingUI = function () {
|
|
44027
|
-
return null;
|
|
44028
|
-
};
|
|
44029
|
-
this._localEngine.hideLoadingUI = function () {
|
|
44030
|
-
return null;
|
|
44031
|
-
};
|
|
44032
|
-
}
|
|
44033
|
-
return this._localEngine;
|
|
44034
|
-
}
|
|
44035
|
-
}, {
|
|
44036
|
-
key: "createScenePreviewFileAsync",
|
|
44037
|
-
value: function () {
|
|
44038
|
-
var _createScenePreviewFileAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(rootUrl, sourceScene, container) {
|
|
44039
|
-
var _this = this;
|
|
44040
|
-
var serialized, serializedScene, scene, helper;
|
|
44041
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
44042
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
44043
|
-
case 0:
|
|
44044
|
-
serialized = BABYLON.SceneSerializer.Serialize(sourceScene);
|
|
44045
|
-
serializedScene = JSON.stringify(serialized);
|
|
44046
|
-
if (!serializedScene) {
|
|
44047
|
-
_context3.next = 8;
|
|
44048
|
-
break;
|
|
44049
|
-
}
|
|
44050
|
-
scene = new BABYLON.Scene(this._localEngine);
|
|
44051
|
-
if (!scene) {
|
|
44052
|
-
_context3.next = 8;
|
|
44053
|
-
break;
|
|
44054
|
-
}
|
|
44055
|
-
helper = new _SceneHelper__WEBPACK_IMPORTED_MODULE_1__.SceneHelper(scene);
|
|
44056
|
-
_context3.next = 8;
|
|
44057
|
-
return new Promise(function (resolve) {
|
|
44058
|
-
BABYLON.SceneLoader.Append(rootUrl, "data:" + serializedScene, scene, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
44059
|
-
var arcCamera, _iterator, _step, meshId, ourMesh;
|
|
44060
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
44061
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
44062
|
-
case 0:
|
|
44063
|
-
_context2.next = 2;
|
|
44064
|
-
return scene.whenReadyAsync();
|
|
44065
|
-
case 2:
|
|
44066
|
-
helper.setupCamera();
|
|
44067
|
-
helper.setupLights();
|
|
44068
|
-
arcCamera = scene.activeCamera;
|
|
44069
|
-
arcCamera.position = _this._options.camera.position;
|
|
44070
|
-
arcCamera.target = _this._options.camera.target;
|
|
44071
|
-
|
|
44072
|
-
// Re render dynamic textures
|
|
44073
|
-
if (!(_this._options.meshesWithCustomizationIds && _this._options.zkDesign && _this._options.zkModel && _this._options.zkScene)) {
|
|
44074
|
-
_context2.next = 33;
|
|
44075
|
-
break;
|
|
44076
|
-
}
|
|
44077
|
-
_iterator = _createForOfIteratorHelper(_this._options.meshesWithCustomizationIds);
|
|
44078
|
-
_context2.prev = 9;
|
|
44079
|
-
_iterator.s();
|
|
44080
|
-
case 11:
|
|
44081
|
-
if ((_step = _iterator.n()).done) {
|
|
44082
|
-
_context2.next = 20;
|
|
44083
|
-
break;
|
|
44084
|
-
}
|
|
44085
|
-
meshId = _step.value;
|
|
44086
|
-
ourMesh = scene.getMeshByID(meshId);
|
|
44087
|
-
if (!ourMesh) {
|
|
44088
|
-
_context2.next = 18;
|
|
44089
|
-
break;
|
|
44090
|
-
}
|
|
44091
|
-
// Restore the original material id if it was changed from the mesh design manager
|
|
44092
|
-
if (ourMesh.metadata && ourMesh.metadata.originalNormalmapMaterialID) {
|
|
44093
|
-
ourMesh.material = scene.materials.find(function (x) {
|
|
44094
|
-
return x.id === ourMesh.metadata.originalNormalmapMaterialID;
|
|
44095
|
-
}) || null;
|
|
44096
|
-
}
|
|
44097
|
-
_context2.next = 18;
|
|
44098
|
-
return _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_0__.MeshDesignManager.createMeshDesignManagerAsync(scene, _this._options.zkScene, ourMesh, ourMesh.subMeshes && ourMesh.subMeshes.length > 0 ? ourMesh.subMeshes[0] : null, _this._options.zkModel, _this._options.zkDesign, true);
|
|
44099
|
-
case 18:
|
|
44100
|
-
_context2.next = 11;
|
|
44101
|
-
break;
|
|
44102
|
-
case 20:
|
|
44103
|
-
_context2.next = 25;
|
|
44104
|
-
break;
|
|
44105
|
-
case 22:
|
|
44106
|
-
_context2.prev = 22;
|
|
44107
|
-
_context2.t0 = _context2["catch"](9);
|
|
44108
|
-
_iterator.e(_context2.t0);
|
|
44109
|
-
case 25:
|
|
44110
|
-
_context2.prev = 25;
|
|
44111
|
-
_iterator.f();
|
|
44112
|
-
return _context2.finish(25);
|
|
44113
|
-
case 28:
|
|
44114
|
-
_context2.next = 30;
|
|
44115
|
-
return new Promise(function (resolve) {
|
|
44116
|
-
setTimeout(function () {
|
|
44117
|
-
resolve();
|
|
44118
|
-
}, 500);
|
|
44119
|
-
});
|
|
44120
|
-
case 30:
|
|
44121
|
-
scene.render();
|
|
44122
|
-
_context2.next = 33;
|
|
44123
|
-
return new Promise(function (resolve) {
|
|
44124
|
-
setTimeout(function () {
|
|
44125
|
-
resolve();
|
|
44126
|
-
}, 500);
|
|
44127
|
-
});
|
|
44128
|
-
case 33:
|
|
44129
|
-
_context2.next = 35;
|
|
44130
|
-
return helper.takeContentScreenshotAsync(_this._options.width || 1024, _this._options.height || 1024);
|
|
44131
|
-
case 35:
|
|
44132
|
-
container.previewFile = _context2.sent;
|
|
44133
|
-
resolve();
|
|
44134
|
-
case 37:
|
|
44135
|
-
case "end":
|
|
44136
|
-
return _context2.stop();
|
|
44137
|
-
}
|
|
44138
|
-
}, _callee2, null, [[9, 22, 25, 28]]);
|
|
44139
|
-
})));
|
|
44140
|
-
});
|
|
44141
|
-
case 8:
|
|
44142
|
-
case "end":
|
|
44143
|
-
return _context3.stop();
|
|
44144
|
-
}
|
|
44145
|
-
}, _callee3, this);
|
|
44146
|
-
}));
|
|
44147
|
-
function createScenePreviewFileAsync(_x4, _x5, _x6) {
|
|
44148
|
-
return _createScenePreviewFileAsync.apply(this, arguments);
|
|
44149
|
-
}
|
|
44150
|
-
return createScenePreviewFileAsync;
|
|
44151
|
-
}()
|
|
44152
|
-
}, {
|
|
44153
|
-
key: "getPreviewsAsync",
|
|
44154
|
-
value: function () {
|
|
44155
|
-
var _getPreviewsAsync2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
44156
|
-
var container;
|
|
44157
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
44158
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
44159
|
-
case 0:
|
|
44160
|
-
this.createLocalEngine();
|
|
44161
|
-
container = new ScenePreviewData();
|
|
44162
|
-
_context4.next = 4;
|
|
44163
|
-
return this.createScenePreviewFileAsync(this._rootUrl, this._scene, container);
|
|
44164
|
-
case 4:
|
|
44165
|
-
this.disposeHostingScene();
|
|
44166
|
-
this.disposeLocalEngine();
|
|
44167
|
-
return _context4.abrupt("return", container);
|
|
44168
|
-
case 7:
|
|
44169
|
-
case "end":
|
|
44170
|
-
return _context4.stop();
|
|
44171
|
-
}
|
|
44172
|
-
}, _callee4, this);
|
|
44173
|
-
}));
|
|
44174
|
-
function getPreviewsAsync() {
|
|
44175
|
-
return _getPreviewsAsync2.apply(this, arguments);
|
|
44176
|
-
}
|
|
44177
|
-
return getPreviewsAsync;
|
|
44178
|
-
}()
|
|
44179
|
-
}, {
|
|
44180
|
-
key: "disposeLocalEngine",
|
|
44181
|
-
value: function disposeLocalEngine() {
|
|
44182
|
-
if (this._localEngine) this._localEngine.dispose();
|
|
44183
|
-
}
|
|
44184
|
-
}, {
|
|
44185
|
-
key: "disposeHostingScene",
|
|
44186
|
-
value: function disposeHostingScene() {
|
|
44187
|
-
if (this._hostingSceneHelper) {
|
|
44188
|
-
this._hostingSceneHelper.dispose();
|
|
44189
|
-
this._hostingSceneHelper = null;
|
|
44190
|
-
}
|
|
44191
|
-
if (this._hostingScene) {
|
|
44192
|
-
this._hostingScene.dispose();
|
|
44193
|
-
this._hostingScene = null;
|
|
44194
|
-
}
|
|
44195
|
-
}
|
|
44196
|
-
}]);
|
|
44197
|
-
return ScenePreviewMaker;
|
|
44198
|
-
}();
|
|
44199
|
-
|
|
44200
|
-
/***/ }),
|
|
44201
|
-
|
|
44202
43931
|
/***/ "../../3D/src/Components/SceneToBlobs/SceneToBlobs.ts":
|
|
44203
43932
|
/*!************************************************************!*\
|
|
44204
43933
|
!*** ../../3D/src/Components/SceneToBlobs/SceneToBlobs.ts ***!
|
|
@@ -55961,11 +55690,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
55961
55690
|
/* harmony import */ var _Components_InfoPointsManager_InfoPointsManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Components/InfoPointsManager/InfoPointsManager */ "../../3D/src/Components/InfoPointsManager/InfoPointsManager.ts");
|
|
55962
55691
|
/* harmony import */ var _Components_MaterialsPreview_MaterialsPreview__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Components/MaterialsPreview/MaterialsPreview */ "../../3D/src/Components/MaterialsPreview/MaterialsPreview.ts");
|
|
55963
55692
|
/* harmony import */ var _Components_SceneHelper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Components/SceneHelper */ "../../3D/src/Components/SceneHelper.ts");
|
|
55964
|
-
/* harmony import */ var
|
|
55965
|
-
/* harmony import */ var
|
|
55966
|
-
/* harmony import */ var
|
|
55967
|
-
/* harmony import */ var
|
|
55968
|
-
/* harmony import */ var _Misc_DefaultAssetUrls__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Misc/DefaultAssetUrls */ "../../3D/src/Misc/DefaultAssetUrls.ts");
|
|
55693
|
+
/* harmony import */ var _Components_Selector_ElementSelector__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Components/Selector/ElementSelector */ "../../3D/src/Components/Selector/ElementSelector.ts");
|
|
55694
|
+
/* harmony import */ var _Helpers_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Helpers/utils */ "../../3D/src/Helpers/utils.ts");
|
|
55695
|
+
/* harmony import */ var _Misc_Database__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Misc/Database */ "../../3D/src/Misc/Database.ts");
|
|
55696
|
+
/* harmony import */ var _Misc_DefaultAssetUrls__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Misc/DefaultAssetUrls */ "../../3D/src/Misc/DefaultAssetUrls.ts");
|
|
55969
55697
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
55970
55698
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
55971
55699
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -55994,7 +55722,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
55994
55722
|
|
|
55995
55723
|
|
|
55996
55724
|
|
|
55997
|
-
|
|
55998
55725
|
var BroadcastChannelEventType = /*#__PURE__*/function (BroadcastChannelEventType) {
|
|
55999
55726
|
BroadcastChannelEventType["CameraMovement"] = "camera-movement";
|
|
56000
55727
|
BroadcastChannelEventType["ScriptExecution"] = "script-execution";
|
|
@@ -56100,7 +55827,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
56100
55827
|
if (options.defaultBackgroundColor) this._defaultBackgroundColor = BABYLON.Color4.FromHexString(options.defaultBackgroundColor);
|
|
56101
55828
|
}
|
|
56102
55829
|
}
|
|
56103
|
-
this._elementSelector = new
|
|
55830
|
+
this._elementSelector = new _Components_Selector_ElementSelector__WEBPACK_IMPORTED_MODULE_11__.ElementSelector();
|
|
56104
55831
|
|
|
56105
55832
|
// metodo init reso asincrono, necessita factory method
|
|
56106
55833
|
//this.init();
|
|
@@ -57098,7 +56825,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
57098
56825
|
}, {
|
|
57099
56826
|
key: "setDefaultSceneEnvironmentTexture",
|
|
57100
56827
|
value: function setDefaultSceneEnvironmentTexture() {
|
|
57101
|
-
var url =
|
|
56828
|
+
var url = _Misc_DefaultAssetUrls__WEBPACK_IMPORTED_MODULE_14__.DefaultAssetUrls.Environment.EnvironmentTextureCDNUrl;
|
|
57102
56829
|
this.setSceneEnvironmentTexture(url);
|
|
57103
56830
|
}
|
|
57104
56831
|
}, {
|
|
@@ -58253,9 +57980,13 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58253
57980
|
zkDesign,
|
|
58254
57981
|
legacyScreenshot,
|
|
58255
57982
|
camera,
|
|
58256
|
-
canvasMeshesOriginalMeshesIds,
|
|
58257
57983
|
dataUrl,
|
|
58258
|
-
|
|
57984
|
+
canvas,
|
|
57985
|
+
originalWidth,
|
|
57986
|
+
originalHeight,
|
|
57987
|
+
originalCameraPosition,
|
|
57988
|
+
originalCameraTarget,
|
|
57989
|
+
cameraTransform,
|
|
58259
57990
|
image,
|
|
58260
57991
|
_args19 = arguments;
|
|
58261
57992
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
@@ -58277,47 +58008,61 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58277
58008
|
this._environmentManager = null;
|
|
58278
58009
|
}
|
|
58279
58010
|
this.setRenderingNeeded();
|
|
58280
|
-
|
|
58281
|
-
|
|
58282
|
-
return (_x$metadata = x.metadata) === null || _x$metadata === void 0 ? void 0 : _x$metadata.iscanvasMesh;
|
|
58283
|
-
}).map(function (x) {
|
|
58284
|
-
return x.metadata.originalMeshID;
|
|
58285
|
-
});
|
|
58011
|
+
|
|
58012
|
+
//const canvasMeshesOriginalMeshesIds: string[] = this.scene.meshes.filter(x => x.metadata?.iscanvasMesh).map(x => x.metadata.originalMeshID);
|
|
58286
58013
|
dataUrl = '';
|
|
58287
58014
|
if (!legacyScreenshot) {
|
|
58288
|
-
_context19.next =
|
|
58015
|
+
_context19.next = 16;
|
|
58289
58016
|
break;
|
|
58290
58017
|
}
|
|
58291
|
-
_context19.next =
|
|
58018
|
+
_context19.next = 13;
|
|
58292
58019
|
return this._sceneHelper.takeContentScreenshotAsync(width, height);
|
|
58293
|
-
case
|
|
58020
|
+
case 13:
|
|
58294
58021
|
dataUrl = _context19.sent;
|
|
58295
|
-
_context19.next =
|
|
58022
|
+
_context19.next = 35;
|
|
58296
58023
|
break;
|
|
58297
|
-
case
|
|
58298
|
-
|
|
58299
|
-
|
|
58300
|
-
|
|
58301
|
-
|
|
58302
|
-
|
|
58303
|
-
|
|
58304
|
-
|
|
58305
|
-
|
|
58306
|
-
|
|
58307
|
-
|
|
58308
|
-
|
|
58309
|
-
|
|
58310
|
-
|
|
58311
|
-
|
|
58312
|
-
|
|
58313
|
-
|
|
58314
|
-
|
|
58315
|
-
|
|
58316
|
-
|
|
58317
|
-
|
|
58318
|
-
|
|
58319
|
-
|
|
58320
|
-
|
|
58024
|
+
case 16:
|
|
58025
|
+
canvas = this._canvas;
|
|
58026
|
+
if (!canvas) {
|
|
58027
|
+
_context19.next = 35;
|
|
58028
|
+
break;
|
|
58029
|
+
}
|
|
58030
|
+
// Resize this canvas to 1024x1024
|
|
58031
|
+
originalWidth = canvas.width;
|
|
58032
|
+
originalHeight = canvas.height;
|
|
58033
|
+
canvas.width = 1024;
|
|
58034
|
+
canvas.height = 1024;
|
|
58035
|
+
|
|
58036
|
+
// Get current camera position and target
|
|
58037
|
+
originalCameraPosition = this.scene.activeCamera.position.clone();
|
|
58038
|
+
originalCameraTarget = this.scene.activeCamera.target.clone();
|
|
58039
|
+
cameraTransform = camera ? {
|
|
58040
|
+
position: new BABYLON.Vector3(camera.get("px"), camera.get("py"), camera.get("pz")),
|
|
58041
|
+
target: new BABYLON.Vector3(camera.get("tx"), camera.get("ty"), camera.get("tz"))
|
|
58042
|
+
} : {
|
|
58043
|
+
position: this._scene.activeCamera.position,
|
|
58044
|
+
target: this._scene.activeCamera.target
|
|
58045
|
+
}; // Set current camera transform
|
|
58046
|
+
this._scene.activeCamera.position = cameraTransform.position;
|
|
58047
|
+
this._scene.activeCamera.target = cameraTransform.target;
|
|
58048
|
+
|
|
58049
|
+
// Render the scene
|
|
58050
|
+
this._scene.render();
|
|
58051
|
+
_context19.next = 30;
|
|
58052
|
+
return this._sceneHelper.takeContentScreenshotAsync(width, height);
|
|
58053
|
+
case 30:
|
|
58054
|
+
dataUrl = _context19.sent;
|
|
58055
|
+
// Reset camera transform
|
|
58056
|
+
this._scene.activeCamera.position = originalCameraPosition;
|
|
58057
|
+
this._scene.activeCamera.target = originalCameraTarget;
|
|
58058
|
+
|
|
58059
|
+
// Reset canvas size
|
|
58060
|
+
canvas.width = originalWidth;
|
|
58061
|
+
canvas.height = originalHeight;
|
|
58062
|
+
case 35:
|
|
58063
|
+
_context19.next = 37;
|
|
58064
|
+
return _Helpers_utils__WEBPACK_IMPORTED_MODULE_12__.Utils.trimImageAsync(dataUrl);
|
|
58065
|
+
case 37:
|
|
58321
58066
|
image = _context19.sent;
|
|
58322
58067
|
if (!image) {
|
|
58323
58068
|
console.error('Failed trimming image.', dataUrl);
|
|
@@ -58325,20 +58070,20 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58325
58070
|
}
|
|
58326
58071
|
|
|
58327
58072
|
// Place on a fixed size canvas
|
|
58328
|
-
_context19.next =
|
|
58329
|
-
return
|
|
58330
|
-
case
|
|
58073
|
+
_context19.next = 41;
|
|
58074
|
+
return _Helpers_utils__WEBPACK_IMPORTED_MODULE_12__.Utils.resizeImageFromDataUri(image, width, height, padding);
|
|
58075
|
+
case 41:
|
|
58331
58076
|
image = _context19.sent;
|
|
58332
58077
|
if (image) {
|
|
58333
|
-
_context19.next =
|
|
58078
|
+
_context19.next = 44;
|
|
58334
58079
|
break;
|
|
58335
58080
|
}
|
|
58336
58081
|
throw new Error('Failed resizing image.');
|
|
58337
|
-
case
|
|
58082
|
+
case 44:
|
|
58338
58083
|
this.refreshEnvironment();
|
|
58339
58084
|
this.postSceneContentScreenshot();
|
|
58340
58085
|
return _context19.abrupt("return", image);
|
|
58341
|
-
case
|
|
58086
|
+
case 47:
|
|
58342
58087
|
case "end":
|
|
58343
58088
|
return _context19.stop();
|
|
58344
58089
|
}
|
|
@@ -58410,7 +58155,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58410
58155
|
case 17:
|
|
58411
58156
|
data = _context20.sent;
|
|
58412
58157
|
_context20.next = 20;
|
|
58413
|
-
return
|
|
58158
|
+
return _Helpers_utils__WEBPACK_IMPORTED_MODULE_12__.Utils.trimImageAsync(data);
|
|
58414
58159
|
case 20:
|
|
58415
58160
|
cropped = _context20.sent;
|
|
58416
58161
|
if (cropped) dataUri = cropped;
|
|
@@ -58942,7 +58687,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58942
58687
|
_context32.next = 7;
|
|
58943
58688
|
break;
|
|
58944
58689
|
}
|
|
58945
|
-
db = new
|
|
58690
|
+
db = new _Misc_Database__WEBPACK_IMPORTED_MODULE_13__.Database(); // carico il file json da IndexedDB
|
|
58946
58691
|
_context32.next = 5;
|
|
58947
58692
|
return db.openAsync();
|
|
58948
58693
|
case 5:
|
|
@@ -58975,7 +58720,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
58975
58720
|
_context33.next = 9;
|
|
58976
58721
|
break;
|
|
58977
58722
|
}
|
|
58978
|
-
db = new
|
|
58723
|
+
db = new _Misc_Database__WEBPACK_IMPORTED_MODULE_13__.Database(); // carico il file json da IndexedDB
|
|
58979
58724
|
_context33.next = 7;
|
|
58980
58725
|
return db.openAsync();
|
|
58981
58726
|
case 7:
|
|
@@ -59009,7 +58754,7 @@ var SceneViewer = /*#__PURE__*/function () {
|
|
|
59009
58754
|
_context34.next = 10;
|
|
59010
58755
|
break;
|
|
59011
58756
|
}
|
|
59012
|
-
db = new
|
|
58757
|
+
db = new _Misc_Database__WEBPACK_IMPORTED_MODULE_13__.Database();
|
|
59013
58758
|
_context34.next = 8;
|
|
59014
58759
|
return db.openAsync();
|
|
59015
58760
|
case 8:
|