@lv-x-software-house/x_view 1.2.6-dev.48 → 1.2.6-dev.50

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,30 +16023,36 @@ 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.5;
16026
+ const panSpeed = 1.5;
16027
16027
  const rotateSpeed = 0.02;
16028
16028
  const zoomInFactor = 0.98;
16029
16029
  const zoomOutFactor = 1.02;
16030
16030
  const isShift = !!keysPressed["shiftKey"];
16031
16031
  const isCtrl = !!keysPressed["ctrlKey"];
16032
- if (isCtrl) {
16032
+ const dirX = (keysPressed["ArrowRight"] ? 1 : 0) - (keysPressed["ArrowLeft"] ? 1 : 0);
16033
+ const dirY = (keysPressed["ArrowUp"] ? 1 : 0) - (keysPressed["ArrowDown"] ? 1 : 0);
16034
+ if (isCtrl && (dirX !== 0 || dirY !== 0)) {
16033
16035
  const offset = sceneCamera.position.clone().sub(sceneControls.target);
16034
16036
  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;
16037
+ spherical.theta += dirX * rotateSpeed;
16038
+ spherical.phi -= dirY * rotateSpeed;
16039
16039
  spherical.makeSafe();
16040
16040
  offset.setFromSpherical(spherical);
16041
16041
  sceneCamera.position.copy(sceneControls.target).add(offset);
16042
- } else if (isShift) {
16043
- if (keysPressed["ArrowUp"]) sceneControls.dollyIn(zoomInFactor);
16044
- if (keysPressed["ArrowDown"]) sceneControls.dollyOut(zoomOutFactor);
16045
- } else {
16046
- if (keysPressed["ArrowLeft"]) sceneControls.panLeft(panSpeed, sceneCamera.matrix);
16047
- if (keysPressed["ArrowRight"]) sceneControls.panLeft(-panSpeed, sceneCamera.matrix);
16048
- if (keysPressed["ArrowUp"]) sceneControls.panUp(panSpeed, sceneCamera.matrix);
16049
- if (keysPressed["ArrowDown"]) sceneControls.panUp(-panSpeed, sceneCamera.matrix);
16042
+ } else if (isShift && dirY !== 0) {
16043
+ const factor = keysPressed["ArrowUp"] ? zoomInFactor : zoomOutFactor;
16044
+ const offset = sceneCamera.position.clone().sub(sceneControls.target);
16045
+ offset.multiplyScalar(factor);
16046
+ sceneCamera.position.copy(sceneControls.target).add(offset);
16047
+ } else if (!isCtrl && !isShift && (dirX !== 0 || dirY !== 0)) {
16048
+ const distance = sceneCamera.position.distanceTo(sceneControls.target);
16049
+ const currentPanSpeed = panSpeed * (distance / 100);
16050
+ const vecX = new THREE3.Vector3().setFromMatrixColumn(sceneCamera.matrix, 0);
16051
+ const vecY = new THREE3.Vector3().setFromMatrixColumn(sceneCamera.matrix, 1);
16052
+ vecX.multiplyScalar(dirX * currentPanSpeed);
16053
+ vecY.multiplyScalar(dirY * currentPanSpeed);
16054
+ sceneCamera.position.add(vecX).add(vecY);
16055
+ sceneControls.target.add(vecX).add(vecY);
16050
16056
  }
16051
16057
  }
16052
16058
  stateRef.current.controls.update();
package/dist/index.mjs CHANGED
@@ -16079,30 +16079,36 @@ 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.5;
16082
+ const panSpeed = 1.5;
16083
16083
  const rotateSpeed = 0.02;
16084
16084
  const zoomInFactor = 0.98;
16085
16085
  const zoomOutFactor = 1.02;
16086
16086
  const isShift = !!keysPressed["shiftKey"];
16087
16087
  const isCtrl = !!keysPressed["ctrlKey"];
16088
- if (isCtrl) {
16088
+ const dirX = (keysPressed["ArrowRight"] ? 1 : 0) - (keysPressed["ArrowLeft"] ? 1 : 0);
16089
+ const dirY = (keysPressed["ArrowUp"] ? 1 : 0) - (keysPressed["ArrowDown"] ? 1 : 0);
16090
+ if (isCtrl && (dirX !== 0 || dirY !== 0)) {
16089
16091
  const offset = sceneCamera.position.clone().sub(sceneControls.target);
16090
16092
  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;
16093
+ spherical.theta += dirX * rotateSpeed;
16094
+ spherical.phi -= dirY * rotateSpeed;
16095
16095
  spherical.makeSafe();
16096
16096
  offset.setFromSpherical(spherical);
16097
16097
  sceneCamera.position.copy(sceneControls.target).add(offset);
16098
- } else if (isShift) {
16099
- if (keysPressed["ArrowUp"]) sceneControls.dollyIn(zoomInFactor);
16100
- if (keysPressed["ArrowDown"]) sceneControls.dollyOut(zoomOutFactor);
16101
- } else {
16102
- if (keysPressed["ArrowLeft"]) sceneControls.panLeft(panSpeed, sceneCamera.matrix);
16103
- if (keysPressed["ArrowRight"]) sceneControls.panLeft(-panSpeed, sceneCamera.matrix);
16104
- if (keysPressed["ArrowUp"]) sceneControls.panUp(panSpeed, sceneCamera.matrix);
16105
- if (keysPressed["ArrowDown"]) sceneControls.panUp(-panSpeed, sceneCamera.matrix);
16098
+ } else if (isShift && dirY !== 0) {
16099
+ const factor = keysPressed["ArrowUp"] ? zoomInFactor : zoomOutFactor;
16100
+ const offset = sceneCamera.position.clone().sub(sceneControls.target);
16101
+ offset.multiplyScalar(factor);
16102
+ sceneCamera.position.copy(sceneControls.target).add(offset);
16103
+ } else if (!isCtrl && !isShift && (dirX !== 0 || dirY !== 0)) {
16104
+ const distance = sceneCamera.position.distanceTo(sceneControls.target);
16105
+ const currentPanSpeed = panSpeed * (distance / 100);
16106
+ const vecX = new THREE3.Vector3().setFromMatrixColumn(sceneCamera.matrix, 0);
16107
+ const vecY = new THREE3.Vector3().setFromMatrixColumn(sceneCamera.matrix, 1);
16108
+ vecX.multiplyScalar(dirX * currentPanSpeed);
16109
+ vecY.multiplyScalar(dirY * currentPanSpeed);
16110
+ sceneCamera.position.add(vecX).add(vecY);
16111
+ sceneControls.target.add(vecX).add(vecY);
16106
16112
  }
16107
16113
  }
16108
16114
  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.48",
3
+ "version": "1.2.6-dev.50",
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",