Skip to content

@ue-too/board / restrictRotateByHandler

Function: restrictRotateByHandler()

restrictRotateByHandler(delta, camera, config): number

Defined in: packages/board/src/camera/camera-rig/rotation-handler.ts:288

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

Parameters

delta

number

Rotation angle change in radians

camera

BoardCamera

Current camera instance

config

RotationHandlerRestrictConfig

Restriction configuration

Returns

number

Zero (if locked) or delta (if unlocked)

Remarks

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

Behavior:

  • If restrictRotation is true: Returns 0 (prevents any change)
  • If restrictRotation is false: Returns delta unchanged

Example

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

const delta = Math.PI / 4;  // Try to rotate 45 degrees
const result = restrictRotateByHandler(delta, camera, config);
// result = 0 (rotation locked, no change allowed)

See

createDefaultRotateByHandler for default pipeline usage