@lv-x-software-house/x_view 1.2.6-dev.47 → 1.2.6-dev.49

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 CHANGED
@@ -16023,24 +16023,31 @@ function XViewScene({
16023
16023
  (_b2 = stateRef.current.tweenGroup) == null ? void 0 : _b2.update(time);
16024
16024
  const { keysPressed, controls: sceneControls, camera: sceneCamera } = stateRef.current;
16025
16025
  if (sceneControls && keysPressed) {
16026
- const panSpeed = 0.8;
16027
- const rotateSpeed = 0.025;
16028
- const zoomSpeed = 1.025;
16026
+ const panSpeed = 0.5;
16027
+ const rotateSpeed = 0.02;
16028
+ const zoomInFactor = 0.98;
16029
+ const zoomOutFactor = 1.02;
16029
16030
  const isShift = !!keysPressed["shiftKey"];
16030
16031
  const isCtrl = !!keysPressed["ctrlKey"];
16031
16032
  if (isCtrl) {
16032
- if (keysPressed["ArrowLeft"]) sceneControls._rotateLeft(rotateSpeed);
16033
- if (keysPressed["ArrowRight"]) sceneControls._rotateLeft(-rotateSpeed);
16034
- if (keysPressed["ArrowUp"]) sceneControls._rotateUp(rotateSpeed);
16035
- if (keysPressed["ArrowDown"]) sceneControls._rotateUp(-rotateSpeed);
16033
+ const offset = sceneCamera.position.clone().sub(sceneControls.target);
16034
+ const spherical = new THREE3.Spherical().setFromVector3(offset);
16035
+ if (keysPressed["ArrowLeft"]) spherical.theta += rotateSpeed;
16036
+ if (keysPressed["ArrowRight"]) spherical.theta -= rotateSpeed;
16037
+ if (keysPressed["ArrowUp"]) spherical.phi -= rotateSpeed;
16038
+ if (keysPressed["ArrowDown"]) spherical.phi += rotateSpeed;
16039
+ spherical.makeSafe();
16040
+ offset.setFromSpherical(spherical);
16041
+ sceneCamera.position.copy(sceneControls.target).add(offset);
16036
16042
  } else if (isShift) {
16037
- if (keysPressed["ArrowUp"]) sceneControls._dollyIn(zoomSpeed);
16038
- if (keysPressed["ArrowDown"]) sceneControls._dollyOut(zoomSpeed);
16043
+ if (keysPressed["ArrowUp"]) sceneControls.dollyIn(zoomInFactor);
16044
+ if (keysPressed["ArrowDown"]) sceneControls.dollyOut(zoomOutFactor);
16039
16045
  } else {
16040
- if (keysPressed["ArrowLeft"]) sceneControls.panLeft(panSpeed, sceneCamera.matrix);
16041
- if (keysPressed["ArrowRight"]) sceneControls.panLeft(-panSpeed, sceneCamera.matrix);
16042
- if (keysPressed["ArrowUp"]) sceneControls.panUp(panSpeed, sceneCamera.matrix);
16043
- if (keysPressed["ArrowDown"]) sceneControls.panUp(-panSpeed, sceneCamera.matrix);
16046
+ const panStep = 10;
16047
+ if (keysPressed["ArrowLeft"]) sceneControls.pan(panStep, 0);
16048
+ if (keysPressed["ArrowRight"]) sceneControls.pan(-panStep, 0);
16049
+ if (keysPressed["ArrowUp"]) sceneControls.pan(0, panStep);
16050
+ if (keysPressed["ArrowDown"]) sceneControls.pan(0, -panStep);
16044
16051
  }
16045
16052
  }
16046
16053
  stateRef.current.controls.update();
package/dist/index.mjs CHANGED
@@ -16079,24 +16079,31 @@ function XViewScene({
16079
16079
  (_b2 = stateRef.current.tweenGroup) == null ? void 0 : _b2.update(time);
16080
16080
  const { keysPressed, controls: sceneControls, camera: sceneCamera } = stateRef.current;
16081
16081
  if (sceneControls && keysPressed) {
16082
- const panSpeed = 0.8;
16083
- const rotateSpeed = 0.025;
16084
- const zoomSpeed = 1.025;
16082
+ const panSpeed = 0.5;
16083
+ const rotateSpeed = 0.02;
16084
+ const zoomInFactor = 0.98;
16085
+ const zoomOutFactor = 1.02;
16085
16086
  const isShift = !!keysPressed["shiftKey"];
16086
16087
  const isCtrl = !!keysPressed["ctrlKey"];
16087
16088
  if (isCtrl) {
16088
- if (keysPressed["ArrowLeft"]) sceneControls._rotateLeft(rotateSpeed);
16089
- if (keysPressed["ArrowRight"]) sceneControls._rotateLeft(-rotateSpeed);
16090
- if (keysPressed["ArrowUp"]) sceneControls._rotateUp(rotateSpeed);
16091
- if (keysPressed["ArrowDown"]) sceneControls._rotateUp(-rotateSpeed);
16089
+ const offset = sceneCamera.position.clone().sub(sceneControls.target);
16090
+ const spherical = new THREE3.Spherical().setFromVector3(offset);
16091
+ if (keysPressed["ArrowLeft"]) spherical.theta += rotateSpeed;
16092
+ if (keysPressed["ArrowRight"]) spherical.theta -= rotateSpeed;
16093
+ if (keysPressed["ArrowUp"]) spherical.phi -= rotateSpeed;
16094
+ if (keysPressed["ArrowDown"]) spherical.phi += rotateSpeed;
16095
+ spherical.makeSafe();
16096
+ offset.setFromSpherical(spherical);
16097
+ sceneCamera.position.copy(sceneControls.target).add(offset);
16092
16098
  } else if (isShift) {
16093
- if (keysPressed["ArrowUp"]) sceneControls._dollyIn(zoomSpeed);
16094
- if (keysPressed["ArrowDown"]) sceneControls._dollyOut(zoomSpeed);
16099
+ if (keysPressed["ArrowUp"]) sceneControls.dollyIn(zoomInFactor);
16100
+ if (keysPressed["ArrowDown"]) sceneControls.dollyOut(zoomOutFactor);
16095
16101
  } else {
16096
- if (keysPressed["ArrowLeft"]) sceneControls.panLeft(panSpeed, sceneCamera.matrix);
16097
- if (keysPressed["ArrowRight"]) sceneControls.panLeft(-panSpeed, sceneCamera.matrix);
16098
- if (keysPressed["ArrowUp"]) sceneControls.panUp(panSpeed, sceneCamera.matrix);
16099
- if (keysPressed["ArrowDown"]) sceneControls.panUp(-panSpeed, sceneCamera.matrix);
16102
+ const panStep = 10;
16103
+ if (keysPressed["ArrowLeft"]) sceneControls.pan(panStep, 0);
16104
+ if (keysPressed["ArrowRight"]) sceneControls.pan(-panStep, 0);
16105
+ if (keysPressed["ArrowUp"]) sceneControls.pan(0, panStep);
16106
+ if (keysPressed["ArrowDown"]) sceneControls.pan(0, -panStep);
16100
16107
  }
16101
16108
  }
16102
16109
  stateRef.current.controls.update();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.6-dev.47",
3
+ "version": "1.2.6-dev.49",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",