mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 07:32:05 +00:00
fix: swipe controls sensitive to horizontal swipes
This commit is contained in:
parent
5a7d2ad505
commit
3bb3c7436f
1 changed files with 11 additions and 10 deletions
|
|
@ -8,7 +8,6 @@ export function swipeControls(node, props = { enabled: true, immersePlayer: () =
|
|||
const isNative = Capacitor.isNativePlatform();
|
||||
let brightness = 50;
|
||||
let volume = 50; // Start at middle volume (range 0-100)
|
||||
let startX = 0;
|
||||
let startY = 0;
|
||||
let isDragging = false;
|
||||
let activeControl = null;
|
||||
|
|
@ -86,16 +85,18 @@ export function swipeControls(node, props = { enabled: true, immersePlayer: () =
|
|||
const rect = node.getBoundingClientRect();
|
||||
const sensitivity = 0.5 * (200 / rect.height);
|
||||
|
||||
if (activeControl === 'brightness') {
|
||||
brightness = Math.max(0, Math.min(100, brightness + deltaY * sensitivity));
|
||||
updateBrightness();
|
||||
} else if (activeControl === 'volume') {
|
||||
volume = Math.max(0, Math.min(100, volume + deltaY * sensitivity));
|
||||
debouncedUpdateVolume();
|
||||
}
|
||||
if (Math.abs(deltaY) > 5) {
|
||||
if (activeControl === 'brightness') {
|
||||
brightness = Math.max(0, Math.min(100, brightness + deltaY * sensitivity));
|
||||
updateBrightness();
|
||||
} else if (activeControl === 'volume') {
|
||||
volume = Math.max(0, Math.min(100, volume + deltaY * sensitivity));
|
||||
debouncedUpdateVolume();
|
||||
}
|
||||
|
||||
showControlsIndicator();
|
||||
startY = currentY;
|
||||
showControlsIndicator();
|
||||
startY = currentY;
|
||||
}
|
||||
}
|
||||
|
||||
function handleTouchEnd() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue