From c35590dbda7d9b0b7a6dac67ce5e79a088a0261a Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Fri, 11 Mar 2016 04:54:06 -0600 Subject: [PATCH] Allows UI.toggleFilmStrip() and UIEvents.TOGGLE_FILM_STRIP to act as setters in addition to toggles. --- modules/UI/UI.js | 3 ++- modules/UI/videolayout/FilmStrip.js | 15 ++++++++++++++- service/UI/UIEvents.js | 11 +++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index e68113ff2..c6e0f9cc4 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -583,7 +583,8 @@ UI.toggleSmileys = function () { * Toggles film strip. */ UI.toggleFilmStrip = function () { - FilmStrip.toggleFilmStrip(); + var self = FilmStrip; + self.toggleFilmStrip.apply(self, arguments); }; /** diff --git a/modules/UI/videolayout/FilmStrip.js b/modules/UI/videolayout/FilmStrip.js index 2e0a8ce50..ccb1783aa 100644 --- a/modules/UI/videolayout/FilmStrip.js +++ b/modules/UI/videolayout/FilmStrip.js @@ -9,7 +9,20 @@ const FilmStrip = { this.filmStrip = $('#remoteVideos'); }, - toggleFilmStrip () { + /** + * Toggles the visibility of the film strip. + * + * @param visible optional {Boolean} which specifies the desired visibility + * of the film strip. If not specified, the visibility will be flipped + * (i.e. toggled); otherwise, the visibility will be set to the specified + * value. + */ + toggleFilmStrip (visible) { + if (typeof visible === 'boolean' + && this.isFilmStripVisible() == visible) { + return; + } + this.filmStrip.toggleClass("hidden"); }, diff --git a/service/UI/UIEvents.js b/service/UI/UIEvents.js index b915b3793..5d1586193 100644 --- a/service/UI/UIEvents.js +++ b/service/UI/UIEvents.js @@ -34,6 +34,17 @@ export default { TOGGLE_CHAT: "UI.toggle_chat", TOGGLE_SETTINGS: "UI.toggle_settings", TOGGLE_CONTACT_LIST: "UI.toggle_contact_list", + /** + * Notifies that a command to toggle the film strip has been issued. The + * event may optionally specify a {Boolean} (primitive) value to assign to + * the visibility of the film strip (i.e. the event may act as a setter). + * The very toggling of the film strip may or may not occurred at the time + * of the receipt of the event depending on the position of the receiving + * event listener in relation to the event listener which carries out the + * command to toggle the film strip. + * + * @see {TOGGLED_FILM_STRIP} + */ TOGGLE_FILM_STRIP: "UI.toggle_film_strip", TOGGLE_SCREENSHARING: "UI.toggle_screensharing", CONTACT_CLICKED: "UI.contact_clicked",