From 619f50d794ca8645d46b066279b6e0fdddd6ca3c Mon Sep 17 00:00:00 2001 From: pavel Date: Thu, 26 Feb 2026 23:36:27 +0100 Subject: [PATCH] fix slider --- desktop/app.js | 12 ++++++++---- static/app.js | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/desktop/app.js b/desktop/app.js index a0d5a5a..0cb3112 100644 --- a/desktop/app.js +++ b/desktop/app.js @@ -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 = ` -
+
${Math.round(vol * 100)}% @@ -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); diff --git a/static/app.js b/static/app.js index c07063f..c76a314 100644 --- a/static/app.js +++ b/static/app.js @@ -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 currently visible }, voicePresencePollId: null, chatWs: null, @@ -371,8 +372,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 = ` -
+
${Math.round(vol * 100)}% @@ -409,10 +411,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);