Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 3ef2017

Browse files
committed
Fix issues with the controls disappearing
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 1754602 commit 3ef2017

File tree

2 files changed

+24
-36
lines changed

2 files changed

+24
-36
lines changed

res/css/views/voip/_CallView.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ limitations under the License.
313313
display: flex;
314314
justify-content: center;
315315
bottom: 5px;
316-
width: 100%;
317316
opacity: 1;
318317
transition: opacity 0.5s;
319318
z-index: 200; // To be above _all_ feeds

src/components/views/voip/CallView.tsx

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ interface IState {
6767
screensharing: boolean;
6868
callState: CallState;
6969
controlsVisible: boolean;
70+
hoveringControls: boolean;
7071
showMoreMenu: boolean;
7172
showDialpad: boolean;
7273
primaryFeed: CallFeed;
@@ -128,6 +129,7 @@ export default class CallView extends React.Component<IProps, IState> {
128129
screensharing: this.props.call.isScreensharing(),
129130
callState: this.props.call.state,
130131
controlsVisible: true,
132+
hoveringControls: false,
131133
showMoreMenu: false,
132134
showDialpad: false,
133135
primaryFeed: primary,
@@ -244,6 +246,7 @@ export default class CallView extends React.Component<IProps, IState> {
244246
};
245247

246248
private onControlsHideTimer = () => {
249+
if (this.state.hoveringControls || this.state.showDialpad || this.state.showMoreMenu) return;
247250
this.controlsHideTimer = null;
248251
this.setState({
249252
controlsVisible: false,
@@ -293,24 +296,10 @@ export default class CallView extends React.Component<IProps, IState> {
293296

294297
private onDialpadClick = (): void => {
295298
if (!this.state.showDialpad) {
296-
if (this.controlsHideTimer) {
297-
clearTimeout(this.controlsHideTimer);
298-
this.controlsHideTimer = null;
299-
}
300-
301-
this.setState({
302-
showDialpad: true,
303-
controlsVisible: true,
304-
});
299+
this.setState({ showDialpad: true });
300+
this.showControls();
305301
} else {
306-
if (this.controlsHideTimer !== null) {
307-
clearTimeout(this.controlsHideTimer);
308-
}
309-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
310-
311-
this.setState({
312-
showDialpad: false,
313-
});
302+
this.setState({ showDialpad: false });
314303
}
315304
};
316305

@@ -345,29 +334,16 @@ export default class CallView extends React.Component<IProps, IState> {
345334
};
346335

347336
private onMoreClick = (): void => {
348-
if (this.controlsHideTimer) {
349-
clearTimeout(this.controlsHideTimer);
350-
this.controlsHideTimer = null;
351-
}
352-
353-
this.setState({
354-
showMoreMenu: true,
355-
controlsVisible: true,
356-
});
337+
this.setState({ showMoreMenu: true });
338+
this.showControls();
357339
};
358340

359341
private closeDialpad = (): void => {
360-
this.setState({
361-
showDialpad: false,
362-
});
363-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
342+
this.setState({ showDialpad: false });
364343
};
365344

366345
private closeContextMenu = (): void => {
367-
this.setState({
368-
showMoreMenu: false,
369-
});
370-
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
346+
this.setState({ showMoreMenu: false });
371347
};
372348

373349
// we register global shortcuts here, they *must not conflict* with local shortcuts elsewhere or both will fire
@@ -403,6 +379,15 @@ export default class CallView extends React.Component<IProps, IState> {
403379
}
404380
};
405381

382+
private onCallControlsMouseEnter = (): void => {
383+
this.setState({ hoveringControls: true });
384+
this.showControls();
385+
};
386+
387+
private onCallControlsMouseLeave = (): void => {
388+
this.setState({ hoveringControls: false });
389+
};
390+
406391
private onRoomAvatarClick = (): void => {
407392
const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call);
408393
dis.dispatch({
@@ -561,7 +546,11 @@ export default class CallView extends React.Component<IProps, IState> {
561546
}
562547

563548
return (
564-
<div className={callControlsClasses}>
549+
<div
550+
className={callControlsClasses}
551+
onMouseEnter={this.onCallControlsMouseEnter}
552+
onMouseLeave={this.onCallControlsMouseLeave}
553+
>
565554
{ dialpadButton }
566555
<AccessibleButton
567556
className={micClasses}

0 commit comments

Comments
 (0)