Skip to content

@ue-too/board / index / restrictRotateToHandler

函式: restrictRotateToHandler() ​

restrictRotateToHandler(targetRotation, camera, config): number

定義於: packages/board/src/camera/camera-rig/rotation-handler.ts:382

Handler pipeline step that prevents "rotate to" operations when rotation is locked.

參數 ​

targetRotation ​

number

Target rotation angle in radians

camera ​

BoardCamera

Current camera instance

config ​

RotationHandlerRestrictConfig

Restriction configuration

回傳 ​

number

Current rotation (if locked) or target (if unlocked)

備註 ​

This handler implements a global rotation lock for absolute rotation operations.

Behavior:

  • If restrictRotation is true: Returns current rotation (prevents any change)
  • If restrictRotation is false: Returns target unchanged

範例 ​

typescript
camera.rotation = Math.PI / 2;  // Currently at 90 degrees

const config: RotationHandlerRestrictConfig = {
  restrictRotation: true  // Lock rotation
};

const target = Math.PI;  // Try to rotate to 180 degrees
const result = restrictRotateToHandler(target, camera, config);
// result = π/2 (rotation locked, returns current angle)

參閱 ​

createDefaultRotateToHandler for default pipeline usage