Only show Peer controls when hovering
parent
79376b3a50
commit
55c1506281
|
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
@ -8,7 +8,27 @@ import * as stateActions from '../redux/stateActions';
|
||||||
import PeerView from './PeerView';
|
import PeerView from './PeerView';
|
||||||
import ScreenView from './ScreenView';
|
import ScreenView from './ScreenView';
|
||||||
|
|
||||||
const Peer = (props) =>
|
class Peer extends Component
|
||||||
|
{
|
||||||
|
state = {
|
||||||
|
controlsVisible : false
|
||||||
|
};
|
||||||
|
|
||||||
|
handleMouseOver = () =>
|
||||||
|
{
|
||||||
|
this.setState({
|
||||||
|
controlsVisible : true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleMouseOut = () =>
|
||||||
|
{
|
||||||
|
this.setState({
|
||||||
|
controlsVisible : false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render()
|
||||||
{
|
{
|
||||||
const {
|
const {
|
||||||
advancedMode,
|
advancedMode,
|
||||||
|
|
@ -24,7 +44,7 @@ const Peer = (props) =>
|
||||||
onEnableScreen,
|
onEnableScreen,
|
||||||
toggleConsumerFullscreen,
|
toggleConsumerFullscreen,
|
||||||
style
|
style
|
||||||
} = props;
|
} = this.props;
|
||||||
|
|
||||||
const micEnabled = (
|
const micEnabled = (
|
||||||
Boolean(micConsumer) &&
|
Boolean(micConsumer) &&
|
||||||
|
|
@ -60,6 +80,8 @@ const Peer = (props) =>
|
||||||
className={classnames({
|
className={classnames({
|
||||||
screen : screenConsumer
|
screen : screenConsumer
|
||||||
})}
|
})}
|
||||||
|
onMouseOver={this.handleMouseOver}
|
||||||
|
onMouseOut={this.handleMouseOut}
|
||||||
>
|
>
|
||||||
{videoVisible && !webcamConsumer.supported ?
|
{videoVisible && !webcamConsumer.supported ?
|
||||||
<div className='incompatible-video'>
|
<div className='incompatible-video'>
|
||||||
|
|
@ -69,7 +91,11 @@ const Peer = (props) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div className={classnames('view-container', 'webcam')} style={style}>
|
<div className={classnames('view-container', 'webcam')} style={style}>
|
||||||
<div className='controls'>
|
<div
|
||||||
|
className={classnames('controls', {
|
||||||
|
visible : this.state.controlsVisible
|
||||||
|
})}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
className={classnames('button', 'mic', {
|
className={classnames('button', 'mic', {
|
||||||
on : micEnabled,
|
on : micEnabled,
|
||||||
|
|
@ -156,7 +182,8 @@ const Peer = (props) =>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Peer.propTypes =
|
Peer.propTypes =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,30 +15,11 @@ import ToolAreaButton from './ToolArea/ToolAreaButton';
|
||||||
import ToolArea from './ToolArea/ToolArea';
|
import ToolArea from './ToolArea/ToolArea';
|
||||||
import FullScreenView from './FullScreenView';
|
import FullScreenView from './FullScreenView';
|
||||||
import Draggable from 'react-draggable';
|
import Draggable from 'react-draggable';
|
||||||
|
import { idle } from '../utils';
|
||||||
|
|
||||||
// Hide toolbars after 10 seconds of inactivity.
|
// Hide toolbars after 10 seconds of inactivity.
|
||||||
const TIMEOUT = 10 * 1000;
|
const TIMEOUT = 10 * 1000;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a function which will call the callback function
|
|
||||||
* after the given amount of milliseconds has passed since
|
|
||||||
* the last time the callback function was called.
|
|
||||||
*/
|
|
||||||
const idle = (callback, delay) =>
|
|
||||||
{
|
|
||||||
let handle;
|
|
||||||
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
if (handle)
|
|
||||||
{
|
|
||||||
clearTimeout(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
handle = setTimeout(callback, delay);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class Room extends React.Component
|
class Room extends React.Component
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,23 @@ export function getBrowserType()
|
||||||
|
|
||||||
return 'N/A';
|
return 'N/A';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a function which will call the callback function
|
||||||
|
* after the given amount of milliseconds has passed since
|
||||||
|
* the last time the callback function was called.
|
||||||
|
*/
|
||||||
|
export const idle = (callback, delay) =>
|
||||||
|
{
|
||||||
|
let handle;
|
||||||
|
|
||||||
|
return () =>
|
||||||
|
{
|
||||||
|
if (handle)
|
||||||
|
{
|
||||||
|
clearTimeout(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
handle = setTimeout(callback, delay);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -41,6 +41,15 @@
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0.4vmin;
|
padding: 0.4vmin;
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
animation: fade-out 0.3s;
|
||||||
|
|
||||||
|
&.visible {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
animation: fade-in 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
> .button {
|
> .button {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
|
|
||||||
|
|
@ -440,27 +440,3 @@
|
||||||
@keyframes Room-info-state-connecting {
|
@keyframes Room-info-state-connecting {
|
||||||
50% { background-color: rgba(orange, 0.75); }
|
50% { background-color: rgba(orange, 0.75); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fade-in {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fade-out {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,6 +5,7 @@ global-reset();
|
||||||
@import './mixins';
|
@import './mixins';
|
||||||
@import './fonts';
|
@import './fonts';
|
||||||
@import './reset';
|
@import './reset';
|
||||||
|
@import './keyframes';
|
||||||
|
|
||||||
html {
|
html {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
@keyframes fade-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade-out {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue