@perceptimagery/dita-configurator-staging 0.1.7301 → 0.1.7400

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 +42 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -111,7 +111,7 @@ var __publicField = (obj, key, value) => {
111
111
  host: "https://api.sprie.io"
112
112
  };
113
113
  const config = Object.freeze(Config$1);
114
- const version$1 = "0.1.7301";
114
+ const version$1 = "0.1.7400";
115
115
  function modifyLensArr(arr, element) {
116
116
  const index = arr.findIndex((e) => e["sku"] === element["sku"]);
117
117
  if (index !== -1) {
@@ -41462,8 +41462,9 @@ bool bvhIntersectFirstHit(
41462
41462
  }
41463
41463
  async intialize() {
41464
41464
  var _a;
41465
- const newWidth = document.querySelector("canvas.sprie-config-webgl").clientWidth;
41466
- const newHeight = document.querySelector("canvas.sprie-config-webgl").clientHeight;
41465
+ const canvas = document.querySelector("canvas.sprie-config-webgl");
41466
+ const newWidth = canvas.clientWidth;
41467
+ const newHeight = canvas.clientHeight;
41467
41468
  this.camera = new PerspectiveCamera(
41468
41469
  12,
41469
41470
  newWidth / newHeight,
@@ -41477,8 +41478,7 @@ bool bvhIntersectFirstHit(
41477
41478
  alpha: true,
41478
41479
  antialias: true
41479
41480
  });
41480
- this.renderer.setSize(newWidth, newHeight);
41481
- this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
41481
+ this.resizeRenderer();
41482
41482
  const rgbeLoader = new RGBELoader();
41483
41483
  rgbeLoader.load(
41484
41484
  "https://sprie-jarvis-public.s3.eu-west-2.amazonaws.com/environment_desaturated.hdr",
@@ -41516,6 +41516,17 @@ bool bvhIntersectFirstHit(
41516
41516
  temp5.FAST_CHROMA = "";
41517
41517
  diamondMaterial.defines = temp5;
41518
41518
  }
41519
+ resizeRenderer() {
41520
+ var _a;
41521
+ const pixelRatio = Math.min(window.devicePixelRatio, 2);
41522
+ const resoWidth = Math.floor(this.canvas.clientWidth * pixelRatio);
41523
+ const resoHeight = Math.floor(this.canvas.clientHeight * pixelRatio);
41524
+ const needResize = this.canvas.width !== resoWidth || this.canvas.height !== resoHeight;
41525
+ if (needResize) {
41526
+ (_a = this.renderer) == null ? void 0 : _a.setSize(resoWidth, resoHeight, false);
41527
+ }
41528
+ return needResize;
41529
+ }
41519
41530
  cleanUp() {
41520
41531
  if (this.renderer) {
41521
41532
  this.renderer.dispose();
@@ -41960,13 +41971,27 @@ bool bvhIntersectFirstHit(
41960
41971
  -0.13425621157020154,
41961
41972
  -0.2564218846390263
41962
41973
  );
41963
- this.camera.position.set(
41964
- 2.2,
41965
- 2.2,
41966
- 4
41967
- );
41968
- controls.minDistance = 1;
41969
- controls.maxDistance = 5;
41974
+ const rendererSize = this.renderer.getSize(new Vector2());
41975
+ console.log(rendererSize);
41976
+ if (rendererSize.x > rendererSize.y) {
41977
+ this.camera.position.set(
41978
+ 2.2,
41979
+ 2.2,
41980
+ 4
41981
+ );
41982
+ controls.minDistance = 2;
41983
+ controls.maxDistance = 7;
41984
+ controls.rotateSpeed = 0.5;
41985
+ } else {
41986
+ this.camera.position.set(
41987
+ 4.2,
41988
+ 5.2,
41989
+ 12
41990
+ );
41991
+ controls.minDistance = 3;
41992
+ controls.maxDistance = 14;
41993
+ controls.rotateSpeed = 0.8;
41994
+ }
41970
41995
  controls.enableDamping = true;
41971
41996
  controls.dampingFactor = 0.2;
41972
41997
  controls.enablePan = true;
@@ -42076,7 +42101,12 @@ bool bvhIntersectFirstHit(
42076
42101
  composer.addPass(renderPass);
42077
42102
  composer.addPass(outputPass);
42078
42103
  const animate = () => {
42104
+ var _a;
42079
42105
  controls.update();
42106
+ if (this.resizeRenderer()) {
42107
+ this.camera.aspect = this.canvas.clientWidth / this.canvas.clientHeight;
42108
+ (_a = this.camera) == null ? void 0 : _a.updateProjectionMatrix();
42109
+ }
42080
42110
  const initialBackground = this.scene.background;
42081
42111
  this.scene.background = null;
42082
42112
  this.scene.overrideMaterial = depthMaterial;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perceptimagery/dita-configurator-staging",
3
- "version": "0.1.7301",
3
+ "version": "0.1.7400",
4
4
  "author": "Rohan Satpute <rohan@perceptimagery.com>",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",