This commit is contained in:
@@ -98,6 +98,17 @@ export function nextTotalAfterLocalTaskAdd(total: number) {
|
||||
return Math.max(0, Number(total) || 0) + 1
|
||||
}
|
||||
|
||||
export function clampFabPosition(x: number, y: number, viewportWidth: number, viewportHeight: number, size = 52, margin = 14, bottomReserved = 74) {
|
||||
return {
|
||||
x: Math.min(Math.max(x, margin), Math.max(margin, viewportWidth - size - margin)),
|
||||
y: Math.min(Math.max(y, margin), Math.max(margin, viewportHeight - size - bottomReserved)),
|
||||
}
|
||||
}
|
||||
|
||||
export function isFabDrag(deltaX: number, deltaY: number, threshold = 8) {
|
||||
return Math.hypot(deltaX, deltaY) >= threshold
|
||||
}
|
||||
|
||||
export function formatApiErrorDetail(detail: unknown): string {
|
||||
if (typeof detail === 'string') return detail
|
||||
if (Array.isArray(detail)) {
|
||||
|
||||
Reference in New Issue
Block a user