mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-03-19 18:10:21 +00:00
Adds touch-screen support for resizing filmstrip and chat panels to enable tablet and touch-laptop users to adjust panel widths. Previously, drag handles only worked with mouse hover, making panels non-resizable on touch devices. Changes: - Implement Pointer Events API for unified mouse/touch handling - Add touch device detection with screen size threshold - Make drag handles always visible on touch devices with padding for easier tapping - Maintain identical visual layout between touch and non-touch versions Touch devices with sufficiently large screens now have fully functional drag handles with appropriate hit targets while smaller devices remain disabled to preserve mobile UX.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { MIN_FILMSTRIP_RESIZE_WIDTH } from '../../filmstrip/constants';
|
|
|
|
/**
|
|
* Detects if the current device has touch capability.
|
|
* This includes smartphones, tablets, and laptops with touch screens.
|
|
*
|
|
* @returns {boolean} True if the device supports touch events.
|
|
*/
|
|
export function isTouchDevice(): boolean {
|
|
// Check maxTouchPoints (most reliable for modern browsers)
|
|
if ('maxTouchPoints' in navigator) {
|
|
return navigator.maxTouchPoints > 0;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Determines if resize functionality should be enabled based on device capabilities
|
|
* and screen size. On touch devices, resize is only enabled for larger screens.
|
|
* On non-touch devices (desktop), resize is always enabled.
|
|
*
|
|
* @returns {boolean} True if resize functionality should be available to the user.
|
|
*/
|
|
export function shouldEnableResize(): boolean {
|
|
const hasTouch = isTouchDevice();
|
|
|
|
// On non-touch devices (desktop), always enable resize
|
|
if (!hasTouch) {
|
|
return true;
|
|
}
|
|
|
|
// On touch devices, only enable if screen is large enough.
|
|
return window?.innerWidth >= MIN_FILMSTRIP_RESIZE_WIDTH;
|
|
}
|
|
|
|
export * from './utils.any';
|