fix bug with F shortcut

This commit is contained in:
Ilya Daynatovich 2016-11-03 15:02:03 +02:00
parent 51d48e18c6
commit 1328870a2b
1 changed files with 20 additions and 14 deletions

View File

@ -14,7 +14,6 @@ const FilmStrip = {
this.iconMenuUpClassName = 'icon-menu-up'; this.iconMenuUpClassName = 'icon-menu-up';
this.filmStrip = $('#remoteVideos'); this.filmStrip = $('#remoteVideos');
this.eventEmitter = eventEmitter; this.eventEmitter = eventEmitter;
this.filmStripIsVisible = true;
this._initFilmStripToolbar(); this._initFilmStripToolbar();
this.registerListeners(); this.registerListeners();
}, },
@ -39,11 +38,12 @@ const FilmStrip = {
*/ */
_generateFilmStripToolbar() { _generateFilmStripToolbar() {
let container = document.createElement('div'); let container = document.createElement('div');
let isVisible = this.isFilmStripVisible();
container.className = 'filmstripToolbar'; container.className = 'filmstripToolbar';
container.innerHTML = ` container.innerHTML = `
<button id="hideVideoToolbar"> <button id="hideVideoToolbar">
<i class="icon-menu-${this.filmStripIsVisible ? 'down' : 'up'}"> <i class="icon-menu-${isVisible ? 'down' : 'up'}">
</i> </i>
</button> </button>
`; `;
@ -55,17 +55,15 @@ const FilmStrip = {
* Attach 'click' listener to "hide filmstrip" button * Attach 'click' listener to "hide filmstrip" button
*/ */
registerListeners() { registerListeners() {
$('#videospace').on('click', '#hideVideoToolbar', () => { let toggleFilmstripMethod = this.toggleFilmStrip.bind(this);
let selector = '#hideVideoToolbar';
$('#videospace').on('click', selector, toggleFilmstripMethod);
this.filmStripIsVisible = !this.filmStripIsVisible; let eventEmitter = this.eventEmitter;
this.toggleFilmStrip(this.filmStripIsVisible); let event = UIEvents.TOGGLE_FILM_STRIP;
if (eventEmitter) {
if (this.filmStripIsVisible) { eventEmitter.addListener(event, toggleFilmstripMethod);
this.showMenuDownIcon(); }
} else {
this.showMenuUpIcon();
}
});
}, },
/** /**
@ -95,13 +93,21 @@ const FilmStrip = {
* value. * value.
*/ */
toggleFilmStrip(visible) { toggleFilmStrip(visible) {
if (typeof visible === 'boolean' let isVisibleDefined = typeof visible === 'boolean';
&& this.isFilmStripVisible() == visible) { if (!isVisibleDefined) {
visible = this.isFilmStripVisible();
} else if (this.isFilmStripVisible() === visible) {
return; return;
} }
this.filmStrip.toggleClass("hidden"); this.filmStrip.toggleClass("hidden");
if (!visible) {
this.showMenuDownIcon();
} else {
this.showMenuUpIcon();
}
// Emit/fire UIEvents.TOGGLED_FILM_STRIP. // Emit/fire UIEvents.TOGGLED_FILM_STRIP.
var eventEmitter = this.eventEmitter; var eventEmitter = this.eventEmitter;
if (eventEmitter) { if (eventEmitter) {