@pmndrs/handle
Advanced tools
Comparing version 6.5.0 to 6.5.1-alpha.2
@@ -29,3 +29,3 @@ import { ArrayCamera, Euler, Object3D, Quaternion, Vector3 } from 'three'; | ||
} | ||
const offsetHelper = new Vector3(); | ||
const vectorHelper = new Vector3(); | ||
const zToUpHelper = new Quaternion(); | ||
@@ -59,3 +59,3 @@ export function computeScreenCameraStoreTransformation(pitch, yaw, cameraDistanceToOrigin, origin, position, rotation, up = Object3D.DEFAULT_UP) { | ||
}, | ||
setCameraPosition(x, y, z, keepOffsetToOrigin) { | ||
setCameraPosition(x, y, z, keepOffsetToOrigin = false) { | ||
const update = {}; | ||
@@ -66,11 +66,11 @@ buildCameraPositionUpdate(update, x, y, z, get().origin, upToZ); | ||
eHelper.set(state.pitch, state.yaw, 0, 'YXZ'); | ||
computeOriginToCameraOffset(offsetHelper, state.distance, eHelper, zToUp); | ||
offsetHelper.x -= x; | ||
offsetHelper.y -= y; | ||
offsetHelper.z -= z; | ||
update.origin = offsetHelper.toArray(); | ||
computeOriginToCameraOffset(vectorHelper, state.distance, eHelper, zToUp); | ||
vectorHelper.x -= x; | ||
vectorHelper.y -= y; | ||
vectorHelper.z -= z; | ||
update.origin = vectorHelper.toArray(); | ||
} | ||
set(update); | ||
}, | ||
setOriginPosition(x, y, z, keepOffsetToCamera) { | ||
setOriginPosition(x, y, z, keepOffsetToCamera = false) { | ||
const origin = [x, y, z]; | ||
@@ -80,10 +80,6 @@ const update = { | ||
}; | ||
if (keepOffsetToCamera === true) { | ||
const state = get(); | ||
eHelper.set(state.pitch, state.yaw, 0, 'YXZ'); | ||
computeOriginToCameraOffset(offsetHelper, state.distance, eHelper, zToUp); | ||
offsetHelper.x += x; | ||
offsetHelper.y += y; | ||
offsetHelper.z += z; | ||
buildCameraPositionUpdate(update, offsetHelper.x, offsetHelper.y, offsetHelper.z, origin, upToZ); | ||
if (keepOffsetToCamera === false) { | ||
const { pitch, distance, origin: oldOrigin, yaw } = get(); | ||
computeScreenCameraStoreTransformation(pitch, yaw, distance, oldOrigin, vectorHelper, undefined, up); | ||
buildCameraPositionUpdate(update, vectorHelper.x, vectorHelper.y, vectorHelper.z, origin, upToZ); | ||
} | ||
@@ -90,0 +86,0 @@ set(update); |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/pmndrs/xr", | ||
"version": "6.5.0", | ||
"version": "6.5.1-alpha.2", | ||
"keywords": [ | ||
@@ -25,3 +25,3 @@ "r3f", | ||
"zustand": "^4.5.2", | ||
"@pmndrs/pointer-events": "^6.5.0" | ||
"@pmndrs/pointer-events": "^6.5.1-alpha.2" | ||
}, | ||
@@ -28,0 +28,0 @@ "files": [ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
168388
3922
1