@ue-too/board / restrictPanByHandler
Function: restrictPanByHandler()
restrictPanByHandler(
delta,camera,config):Point
Defined in: packages/board/src/camera/camera-rig/pan-handler.ts:411
Handler pipeline step that applies axis restrictions to "pan by" deltas.
Parameters
delta
Point
Movement delta in world space
camera
Current camera instance
config
Restriction configuration
Returns
Point
Restricted movement delta
Remarks
This handler enforces axis-lock constraints on relative camera movement. It directly transforms the delta according to restriction rules.
Restrictions applied by convertDeltaToComplyWithRestriction:
- World-space axis locks (X/Y)
- Viewport-relative axis locks (horizontal/vertical, accounting for rotation)
Can be used standalone, but typically composed into a handler pipeline via createDefaultPanByHandler or createHandlerChain.
Example
typescript
// Standalone usage - lock to screen-horizontal movement
const config: PanHandlerRestrictionConfig = {
restrictXTranslation: false,
restrictYTranslation: false,
restrictRelativeXTranslation: false,
restrictRelativeYTranslation: true // Lock screen-vertical
};
const delta = { x: 50, y: 30 };
const restricted = restrictPanByHandler(delta, camera, config);
// Result depends on camera rotation - only horizontal screen movement allowedSee
- convertDeltaToComplyWithRestriction for restriction logic
- createDefaultPanByHandler for default pipeline usage