@ue-too/board / index / zoomLevelWithinLimits
関数: zoomLevelWithinLimits()
zoomLevelWithinLimits(
zoomLevel,zoomLevelLimits?):boolean
定義: packages/board/src/camera/utils/zoom.ts:124
Checks if a zoom level is within specified limits.
パラメータ
zoomLevel
number
The zoom level to check
zoomLevelLimits?
Optional zoom constraints
戻り値
boolean
True if zoom level is valid and within limits, false otherwise
Remarks
Returns false if:
- Zoom level is ≤ 0 (invalid zoom)
- Zoom level exceeds maximum limit (if defined)
- Zoom level is below minimum limit (if defined)
Returns true if no limits are defined or zoom is within bounds.
例
typescript
const limits = { min: 0.5, max: 4 };
zoomLevelWithinLimits(2.0, limits); // true
zoomLevelWithinLimits(0.1, limits); // false (below min)
zoomLevelWithinLimits(10, limits); // false (above max)
zoomLevelWithinLimits(-1, limits); // false (negative zoom)
zoomLevelWithinLimits(0, limits); // false (zero zoom)
zoomLevelWithinLimits(2.0); // true (no limits)