Bilibili-Evolved/registry/lib/components/video/player/video-scaling/constants.ts
weedy233 4455da6e20
feat: 添加控制栏按钮开关功能并优化缩放逻辑
- 添加控制栏按钮的显示开关配置选项,实现根据设置动态添加/移除按钮
- 优化缩放逻辑,添加SCALE_MAPPING常量并实现循环切换预设缩放比例
- 移除不常用的50%和200%缩放选项,简化预设列表
- 缩短默认Toast显示时间从3秒至1.5秒
2025-09-04 21:08:49 +08:00

36 lines
863 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ScalePreset } from './types'
// 缩放比例预设选项数组
export const SCALE_PRESETS = ['75%', '100%', '110%', '125%', '150%', '自定义'] as const
// 缩放比例映射表
export const SCALE_MAPPING: Record<ScalePreset, number> = {
'75%': 0.75,
'100%': 1.0,
'110%': 1.1,
'125%': 1.25,
'150%': 1.5,
自定义: 1.0,
}
// 自定义缩放的范围设置
export const CUSTOM_SCALE_CONFIG = {
min: 50, // 50%
max: 300, // 300%
step: 10, // 步长为10%
}
// Toast显示时间配置
export const TOAST_DURATION_CONFIG = {
defaultValue: 1.5, // 默认显示1.5秒
min: 0.5, // 最小0.5秒
max: 5.0, // 最大5秒
step: 0.5, // 步长0.5秒
}
// Toast显示类名
export const TOAST_CLASS_NAME = 'be-video-scale-toast'
// 页面加载后不显示toast的时间阈值毫秒
export const NO_TOAST_TIME_THRESHOLD = 3000