zakeke-configurator-react 0.0.212 → 0.0.213

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28949,6 +28949,8 @@ var MeshLocationsManager = /*#__PURE__*/function () {
28949
28949
  "use strict";
28950
28950
  __webpack_require__.r(__webpack_exports__);
28951
28951
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28952
+ /* harmony export */ "IS_ANDROID": () => (/* binding */ IS_ANDROID),
28953
+ /* harmony export */ "IS_IOS": () => (/* binding */ IS_IOS),
28952
28954
  /* harmony export */ "MeshDesignManager": () => (/* binding */ MeshDesignManager)
28953
28955
  /* harmony export */ });
28954
28956
  /* harmony import */ var _Helpers_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Helpers/debounce */ "../../3D/src/Helpers/debounce.ts");
@@ -28982,6 +28984,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
28982
28984
 
28983
28985
 
28984
28986
 
28987
+ var IS_ANDROID = /android/i.test(navigator.userAgent);
28988
+ var IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !self.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
28985
28989
  var MeshDesignManager = /*#__PURE__*/function () {
28986
28990
  function MeshDesignManager(scene, zkScene, mesh, subMesh, zkModel, zkDesign) {
28987
28991
  var showDesign = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
@@ -29087,12 +29091,16 @@ var MeshDesignManager = /*#__PURE__*/function () {
29087
29091
  this._zkDesign = zkDesign;
29088
29092
  this._showDesign = showDesign;
29089
29093
  if (effect) this._effect = effect;
29094
+
29095
+ // 512 only on iphone
29096
+ if (designTextureResolution === 512 && !IS_IOS) {
29097
+ designTextureResolution = 1024;
29098
+ }
29099
+ console.log("IS_IOS", IS_IOS, designTextureResolution);
29090
29100
  this._baseWidth = designTextureResolution;
29091
29101
  this._baseHeight = designTextureResolution;
29092
29102
  this._textureWidth = designTextureResolution;
29093
29103
  this._textureHeight = designTextureResolution;
29094
-
29095
- //this.initAsync();
29096
29104
  }
29097
29105
 
29098
29106
  // Temporary until we can access internal matrix (speak with Matteo)
@@ -30312,7 +30320,7 @@ var MeshDesignManager = /*#__PURE__*/function () {
30312
30320
  _context17.next = 11;
30313
30321
  return new Promise( /*#__PURE__*/function () {
30314
30322
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(resolve) {
30315
- var _this3$_customizer, _this3$_customizer2, valuesJson, values, matrix, originalCenterX, originalCenterY, zoom;
30323
+ var _this3$_customizer, _this3$_customizer2, valuesJson, values, matrix, zoom, originalCenterX, originalCenterY;
30316
30324
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
30317
30325
  while (1) switch (_context16.prev = _context16.next) {
30318
30326
  case 0:
@@ -30335,11 +30343,11 @@ var MeshDesignManager = /*#__PURE__*/function () {
30335
30343
 
30336
30344
  // If the texture is not 1024 then zoom out because the matrix is based on 1024
30337
30345
  if (_this3._textureWidth !== 1024) {
30338
- originalCenterX = 1024 / 2 - matrix.getTranslation().x;
30339
- originalCenterY = 1024 / 2 - matrix.getTranslation().y;
30340
- _this3._customizer.paper.view.center = new _this3._customizer.paper.Point(originalCenterX, originalCenterY);
30341
30346
  zoom = 1024 / _this3._textureWidth;
30342
30347
  _this3._customizer.paper.view.zoom *= 1 / zoom;
30348
+ originalCenterX = (1024 / 2 - matrix.getTranslation().x) / matrix.getScaling().x;
30349
+ originalCenterY = (1024 / 2 - matrix.getTranslation().y) / matrix.getScaling().y;
30350
+ _this3._customizer.paper.view.center = new _this3._customizer.paper.Point(originalCenterX, originalCenterY);
30343
30351
  }
30344
30352
  _this3._customizer.paper.view.update();
30345
30353
  }
@@ -58795,8 +58803,8 @@ var SceneViewer = /*#__PURE__*/function () {
58795
58803
  // Resize this canvas to 1024x1024
58796
58804
  originalWidth = canvas.width;
58797
58805
  originalHeight = canvas.height;
58798
- canvas.width = 1024;
58799
- canvas.height = 1024;
58806
+ canvas.width = width;
58807
+ canvas.height = height;
58800
58808
 
58801
58809
  // Get current camera position and target
58802
58810
  originalCameraPosition = this.scene.activeCamera.position.clone();
@@ -60763,6 +60771,8 @@ __webpack_require__.r(__webpack_exports__);
60763
60771
  /* harmony export */ "EventState": () => (/* reexport safe */ _Misc_Observable__WEBPACK_IMPORTED_MODULE_45__.EventState),
60764
60772
  /* harmony export */ "ForegroundBackgroundProceduralTexture": () => (/* reexport safe */ _Components_ProceduralTextures_ForegroundBackgroundProceduralTexture__WEBPACK_IMPORTED_MODULE_8__.ForegroundBackgroundProceduralTexture),
60765
60773
  /* harmony export */ "GlowManager": () => (/* reexport safe */ _Components_Glow_GlowManager__WEBPACK_IMPORTED_MODULE_17__.GlowManager),
60774
+ /* harmony export */ "IS_ANDROID": () => (/* reexport safe */ _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_24__.IS_ANDROID),
60775
+ /* harmony export */ "IS_IOS": () => (/* reexport safe */ _Components_DesignManagers_MeshDesignManager__WEBPACK_IMPORTED_MODULE_24__.IS_IOS),
60766
60776
  /* harmony export */ "IncrementalFiles": () => (/* reexport safe */ _Components_IncrementalFiles_IncrementalFiles__WEBPACK_IMPORTED_MODULE_19__.IncrementalFiles),
60767
60777
  /* harmony export */ "InfoPointsManager": () => (/* reexport safe */ _Components_InfoPointsManager_InfoPointsManager__WEBPACK_IMPORTED_MODULE_34__.InfoPointsManager),
60768
60778
  /* harmony export */ "InnerShadow": () => (/* reexport safe */ _Components_Shadows_InnerShadow__WEBPACK_IMPORTED_MODULE_22__.InnerShadow),
@@ -62326,8 +62336,8 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
62326
62336
  _classCallCheck(this, ZakekeEnvironment);
62327
62337
  _defineProperty(this, "booted", false);
62328
62338
  _defineProperty(this, "platformAttributesSelection", []);
62329
- _defineProperty(this, "previewWidth", 768);
62330
- _defineProperty(this, "previewHeight", 768);
62339
+ _defineProperty(this, "previewWidth", 1024);
62340
+ _defineProperty(this, "previewHeight", 1024);
62331
62341
  _defineProperty(this, "clientPreviewWidth", 1024);
62332
62342
  _defineProperty(this, "clientPreviewHeight", 1024);
62333
62343
  _defineProperty(this, "shareUrlPrefix", null);
@@ -66369,6 +66379,10 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
66369
66379
  return _ref80.apply(this, arguments);
66370
66380
  };
66371
66381
  }());
66382
+ if (_helpers__WEBPACK_IMPORTED_MODULE_7__.IS_IOS) {
66383
+ this.previewHeight = 512;
66384
+ this.previewWidth = 512;
66385
+ }
66372
66386
  }
66373
66387
  _createClass(ZakekeEnvironment, [{
66374
66388
  key: "internalProduct",
@@ -66943,7 +66957,6 @@ function _downloadFontsOfDesign() {
66943
66957
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
66944
66958
  while (1) switch (_context2.prev = _context2.next) {
66945
66959
  case 0:
66946
- console.log("donwloading fonts", downloadedFonts);
66947
66960
  // Get all the fonts first
66948
66961
  fonts = [];
66949
66962
  _iterator = _createForOfIteratorHelper(design.get("designItems").models);
@@ -66960,7 +66973,6 @@ function _downloadFontsOfDesign() {
66960
66973
  } finally {
66961
66974
  _iterator.f();
66962
66975
  }
66963
- console.log(fonts);
66964
66976
  fontFamilies = fonts.map(function (fontName) {
66965
66977
  return downloadedFonts.find(function (fontFamily) {
66966
66978
  return fontFamily.name == fontName;
@@ -66969,12 +66981,12 @@ function _downloadFontsOfDesign() {
66969
66981
  return x != null;
66970
66982
  });
66971
66983
  if (!(fontFamilies.length > 0)) {
66972
- _context2.next = 9;
66984
+ _context2.next = 7;
66973
66985
  break;
66974
66986
  }
66975
- _context2.next = 9;
66987
+ _context2.next = 7;
66976
66988
  return loadFonts(fontFamilies);
66977
- case 9:
66989
+ case 7:
66978
66990
  case "end":
66979
66991
  return _context2.stop();
66980
66992
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.212",
3
+ "version": "0.0.213",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",