Filmstrip is extended with "Hide" button

This commit is contained in:
Maxim Voloshin 2016-10-18 18:16:14 +03:00
parent 8b2491c7a2
commit dc93940bbd
2 changed files with 76 additions and 2 deletions

View File

@ -25,9 +25,8 @@
position:absolute; position:absolute;
text-align:right; text-align:right;
height:196px; height:196px;
padding: 10px 10px 10px 5px; padding: 10px 10px 17px 5px;
bottom: 0; bottom: 0;
left: 0;
right: 0; right: 0;
width:auto; width:auto;
border: 2px solid transparent; border: 2px solid transparent;
@ -603,4 +602,39 @@
.moveToCorner + .moveToCorner { .moveToCorner + .moveToCorner {
right: 80px; right: 80px;
}
.filmstripToolbar {
width: 20px;
position: absolute;
right: 4px;
bottom: 20px;
z-index: 6;
button {
font-size: 14px;
line-height: 1.2;
text-align: center;
background: transparent;
opacity: 0.7;
height: auto;
width: 100%;
padding: 0;
margin: 0 1px;
border: none;
-webkit-appearance: none;
&:hover {
opacity: 1;
}
i {
cursor: pointer;
}
}
}
.filmstripToolbar + #remoteVideos {
padding-right: 24px;
} }

View File

@ -12,6 +12,46 @@ const FilmStrip = {
init (eventEmitter) { init (eventEmitter) {
this.filmStrip = $('#remoteVideos'); this.filmStrip = $('#remoteVideos');
this.eventEmitter = eventEmitter; this.eventEmitter = eventEmitter;
this.filmStripIsVisible = true;
this.renderFilmstripToolbar();
this.activateHideButton();
},
/**
* Attach 'click' listener to "hide filmstrip" button
*/
activateHideButton () {
$('#videospace').on('click', '#hideVideoToolbar', () => {
var icon = document.querySelector('#hideVideoToolbar i');
this.filmStripIsVisible = !this.filmStripIsVisible;
this.toggleFilmStrip(this.filmStripIsVisible);
icon.classList.remove(
this.filmStripIsVisible ? 'icon-menu-up' : 'icon-menu-down');
icon.classList.add(
this.filmStripIsVisible ? 'icon-menu-down' : 'icon-menu-up');
});
},
/**
* Shows toolbar on the right of the filmstrip
*/
renderFilmstripToolbar () {
// create toolbar
var container = document.createElement('div');
container.className = 'filmstripToolbar';
container.innerHTML = `
<button id="hideVideoToolbar">
<i class="icon-menu-${this.filmStripIsVisible ? 'down' : 'up'}">
</i>
</button>
`;
// show toolbar
document.querySelector('#videospace')
.insertBefore(container, document.querySelector('#remoteVideos'));
}, },
/** /**