fix slider
This commit is contained in:
parent
77a9f5ee88
commit
619f50d794
2 changed files with 16 additions and 8 deletions
|
|
@ -28,6 +28,7 @@ const state = {
|
|||
viewMode: 'chat', // 'chat' or 'video'
|
||||
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
|
||||
peerGainNodes: new Map(), // userId -> GainNode
|
||||
visibleVolumeSliders: new Set(), // userIds whose sliders are visible
|
||||
},
|
||||
voicePresencePollId: null,
|
||||
onlineUsers: new Set(),
|
||||
|
|
@ -416,8 +417,9 @@ function renderChannels() {
|
|||
let sliderHtml = '';
|
||||
if (p.user_id !== state.me.id) {
|
||||
const vol = state.userVolumes.get(p.user_id) ?? 1.0;
|
||||
const isVisible = state.voice.visibleVolumeSliders.has(p.user_id);
|
||||
sliderHtml = `
|
||||
<div class="user-volume-control" data-user-id="${p.user_id}">
|
||||
<div class="user-volume-control ${isVisible ? 'show-volume' : ''}" data-user-id="${p.user_id}">
|
||||
<i data-lucide="volume-2" style="width: 12px; height: 12px; opacity: 0.6;"></i>
|
||||
<input type="range" min="0" max="2" step="0.1" value="${vol}" class="volume-slider">
|
||||
<span class="vol-pct">${Math.round(vol * 100)}%</span>
|
||||
|
|
@ -454,10 +456,12 @@ function renderChannels() {
|
|||
pRow.addEventListener('contextmenu', (e) => {
|
||||
if (p.user_id === state.me.id) return;
|
||||
e.preventDefault();
|
||||
const control = pRow.querySelector('.user-volume-control');
|
||||
if (control) {
|
||||
control.classList.toggle('show-volume');
|
||||
if (state.voice.visibleVolumeSliders.has(p.user_id)) {
|
||||
state.voice.visibleVolumeSliders.delete(p.user_id);
|
||||
} else {
|
||||
state.voice.visibleVolumeSliders.add(p.user_id);
|
||||
}
|
||||
renderChannels();
|
||||
});
|
||||
|
||||
pList.appendChild(pRow);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue