From 634a18e84712534fc96d9e2d6275c14478c60f5a Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Fri, 28 Oct 2016 11:16:40 -0500 Subject: [PATCH] fix(Thubmnail_PopupMenu): the thumbnail should be considered hovered when the popup menu is hovered --- modules/UI/util/JitsiPopover.js | 5 +++++ modules/UI/videolayout/RemoteVideo.js | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/modules/UI/util/JitsiPopover.js b/modules/UI/util/JitsiPopover.js index 26608ca8d..cd72d6b00 100644 --- a/modules/UI/util/JitsiPopover.js +++ b/modules/UI/util/JitsiPopover.js @@ -83,6 +83,11 @@ var JitsiPopover = (function () { JitsiPopover.prototype.forceHide = function () { $(".jitsipopover").remove(); this.popoverShown = false; + if(this.popoverIsHovered) { //the browser is not firing hover events + //when the element was on hover if got removed. + this.popoverIsHovered = false; + this.onHoverPopover(this.popoverIsHovered); + } }; /** diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 87015baa8..a8f6837e8 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -34,6 +34,7 @@ function RemoteVideo(user, VideoLayout, emitter) { this.bindHoverHandler(); this.flipX = false; this.isLocal = false; + this.popupMenuIsHovered = false; /** * The flag is set to true after the 'onplay' event has been * triggered on the current video element. It goes back to false @@ -89,6 +90,10 @@ RemoteVideo.prototype._initPopupMenu = function (popupMenuElement) { }; let element = $("#" + this.videoSpanId + " .remotevideomenu"); this.popover = new JitsiPopover(element, options); + this.popover.addOnHoverPopover(isHovered => { + this.popupMenuIsHovered = isHovered; + this.updateView(); + }); // override popover show method to make sure we will update the content // before showing the popover @@ -102,6 +107,19 @@ RemoteVideo.prototype._initPopupMenu = function (popupMenuElement) { }.bind(this); }; +/** + * Checks whether current video is considered hovered. Currently it is hovered + * if the mouse is over the video, or if the connection indicator or the popup + * menu is shown(hovered). + * @private + * NOTE: extends SmallVideo's method + */ +RemoteVideo.prototype._isHovered = function () { + let isHovered = SmallVideo.prototype._isHovered.call(this) + || this.popupMenuIsHovered; + return isHovered; +}; + /** * Generates the popup menu content. *