Adjust alignment of remote video menu
This commit is contained in:
parent
2fe69d409b
commit
d84d0b65ca
|
@ -59,11 +59,11 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin absoluteAligning($sizeX, $sizeY) {
|
@mixin absoluteAligning() {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include transform(translate(-#{$sizeX / 2}, -#{$sizeY / 2}))
|
@include transform(translate(-50%, -50%))
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin transform($func) {
|
@mixin transform($func) {
|
||||||
|
|
|
@ -1,57 +1,69 @@
|
||||||
/*Initialize*/
|
/**
|
||||||
ul.popupmenu {
|
* Initialize
|
||||||
|
**/
|
||||||
|
|
||||||
|
.popupmenu {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.popupmenu li {
|
&__item {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
height: 35px;
|
||||||
|
|
||||||
ul.popupmenu li:hover {
|
&:hover {
|
||||||
background-color: $popupMenuSelectedItemBackground;
|
background-color: $popupMenuSelectedItemBackground;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*Link Appearance*/
|
// Link Appearance
|
||||||
ul.popupmenu li a {
|
&__link {
|
||||||
display: block;
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
height: 100%;
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
cursor: hand;
|
cursor: hand;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
color: gray !important;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.popupmenu li a i.icon-kick {
|
&__text {
|
||||||
font-size: 8pt;
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.popupmenu li a span {
|
&__icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 16px;
|
height: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
@include absoluteAligning();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.popupmenu li a div {
|
.icon-kick {
|
||||||
display: inline-block;
|
font-size: 8pt;
|
||||||
line-height: 25px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.popupmenu li a i {
|
|
||||||
line-height: 25px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span.remotevideomenu:hover ul.popupmenu, ul.popupmenu:hover {
|
span.remotevideomenu:hover ul.popupmenu, ul.popupmenu:hover {
|
||||||
display:block !important;
|
display:block !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.disabled {
|
|
||||||
color: gray !important;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
|
@ -472,7 +472,7 @@
|
||||||
|
|
||||||
.userAvatar {
|
.userAvatar {
|
||||||
@include circle(60px);
|
@include circle(60px);
|
||||||
@include absoluteAligning(60px, 60px);
|
@include absoluteAligning();
|
||||||
}
|
}
|
||||||
|
|
||||||
.sharedVideoAvatar {
|
.sharedVideoAvatar {
|
||||||
|
|
|
@ -109,34 +109,57 @@ RemoteVideo.prototype._initPopupMenu = function (popupMenuElement) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
RemoteVideo.prototype._generatePopupContent = function () {
|
RemoteVideo.prototype._generatePopupContent = function () {
|
||||||
var popupmenuElement = document.createElement('ul');
|
let popupmenuElement = document.createElement('ul');
|
||||||
popupmenuElement.className = 'popupmenu';
|
popupmenuElement.className = 'popupmenu';
|
||||||
popupmenuElement.id = `remote_popupmenu_${this.id}`;
|
popupmenuElement.id = `remote_popupmenu_${this.id}`;
|
||||||
|
|
||||||
var muteMenuItem = document.createElement('li');
|
let muteTranslationKey;
|
||||||
var muteLinkItem = document.createElement('a');
|
let muteClassName;
|
||||||
|
|
||||||
var mutedIndicator = "<i class='icon-mic-disabled'></i>";
|
|
||||||
|
|
||||||
var doMuteHTML = mutedIndicator +
|
|
||||||
" <div data-i18n='videothumbnail.domute'></div>";
|
|
||||||
|
|
||||||
var mutedHTML = mutedIndicator +
|
|
||||||
" <div data-i18n='videothumbnail.muted'></div>";
|
|
||||||
|
|
||||||
muteLinkItem.id = "mutelink_" + this.id;
|
|
||||||
|
|
||||||
if (this.isAudioMuted) {
|
if (this.isAudioMuted) {
|
||||||
muteLinkItem.innerHTML = mutedHTML;
|
muteTranslationKey = 'videothumbnail.muted';
|
||||||
muteLinkItem.className = 'mutelink disabled';
|
muteClassName = 'mutelink disabled';
|
||||||
}
|
} else {
|
||||||
else {
|
muteTranslationKey = 'videothumbnail.domute';
|
||||||
muteLinkItem.innerHTML = doMuteHTML;
|
muteClassName = 'mutelink';
|
||||||
muteLinkItem.className = 'mutelink';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delegate event to the document.
|
let muteHandler = this._muteHandler.bind(this);
|
||||||
$(document).on("click", "#mutelink_" + this.id, () => {
|
let kickHandler = this._kickHandler.bind(this);
|
||||||
|
|
||||||
|
let menuItems = [
|
||||||
|
{
|
||||||
|
id: 'mutelink_' + this.id,
|
||||||
|
handler: muteHandler,
|
||||||
|
icon: 'icon-mic-disabled',
|
||||||
|
text: {
|
||||||
|
className: muteClassName,
|
||||||
|
data: {
|
||||||
|
i18n: muteTranslationKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
id: 'ejectlink_' + this.id,
|
||||||
|
handler: kickHandler,
|
||||||
|
icon: 'icon-kick',
|
||||||
|
text: {
|
||||||
|
data: {
|
||||||
|
i18n: 'videothumbnail.kick'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
menuItems.forEach(el => {
|
||||||
|
let menuItem = this._generatePopupMenuItem(el);
|
||||||
|
popupmenuElement.appendChild(menuItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
APP.translation.translateElement($(popupmenuElement));
|
||||||
|
|
||||||
|
return popupmenuElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
RemoteVideo.prototype._muteHandler = function () {
|
||||||
if (this.isAudioMuted)
|
if (this.isAudioMuted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -150,33 +173,53 @@ RemoteVideo.prototype._generatePopupContent = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.popover.forceHide();
|
this.popover.forceHide();
|
||||||
});
|
};
|
||||||
|
|
||||||
muteMenuItem.appendChild(muteLinkItem);
|
RemoteVideo.prototype._kickHandler = function () {
|
||||||
popupmenuElement.appendChild(muteMenuItem);
|
|
||||||
|
|
||||||
var ejectIndicator = "<i style='float:left;' class='icon-kick'></i>";
|
|
||||||
|
|
||||||
var ejectMenuItem = document.createElement('li');
|
|
||||||
var ejectLinkItem = document.createElement('a');
|
|
||||||
|
|
||||||
var ejectText = "<div data-i18n='videothumbnail.kick'></div>";
|
|
||||||
|
|
||||||
ejectLinkItem.className = 'ejectlink';
|
|
||||||
ejectLinkItem.innerHTML = ejectIndicator + ' ' + ejectText;
|
|
||||||
ejectLinkItem.id = "ejectlink_" + this.id;
|
|
||||||
|
|
||||||
$(document).on("click", "#ejectlink_" + this.id, function(){
|
|
||||||
this.emitter.emit(UIEvents.USER_KICKED, this.id);
|
this.emitter.emit(UIEvents.USER_KICKED, this.id);
|
||||||
this.popover.forceHide();
|
this.popover.forceHide();
|
||||||
}.bind(this));
|
};
|
||||||
|
|
||||||
ejectMenuItem.appendChild(ejectLinkItem);
|
RemoteVideo.prototype._generatePopupMenuItem = function (opts = {}) {
|
||||||
popupmenuElement.appendChild(ejectMenuItem);
|
let {
|
||||||
|
id,
|
||||||
|
handler,
|
||||||
|
icon,
|
||||||
|
text
|
||||||
|
} = opts;
|
||||||
|
|
||||||
APP.translation.translateElement($(popupmenuElement));
|
handler = handler || $.noop;
|
||||||
|
|
||||||
return popupmenuElement;
|
let menuItem = document.createElement('li');
|
||||||
|
menuItem.className = 'popupmenu__item';
|
||||||
|
|
||||||
|
let linkItem = document.createElement('a');
|
||||||
|
linkItem.className = 'popupmenu__link';
|
||||||
|
|
||||||
|
if (icon) {
|
||||||
|
let indicator = document.createElement('span');
|
||||||
|
indicator.className = 'popupmenu__icon';
|
||||||
|
indicator.innerHTML = `<i class="${icon}"></i>`;
|
||||||
|
linkItem.appendChild(indicator);
|
||||||
|
}
|
||||||
|
|
||||||
|
let textContent = document.createElement('span');
|
||||||
|
textContent.className = 'popupmenu__text';
|
||||||
|
|
||||||
|
let dataKeys = Object.keys(text.data);
|
||||||
|
dataKeys.forEach(key => {
|
||||||
|
textContent.dataset[key] = text.data[key];
|
||||||
|
});
|
||||||
|
textContent.className += ` ${text.className}` || '';
|
||||||
|
|
||||||
|
linkItem.appendChild(textContent);
|
||||||
|
linkItem.id = id;
|
||||||
|
|
||||||
|
// Delegate event to the document.
|
||||||
|
$(document).on("click", `#${id}`, handler);
|
||||||
|
menuItem.appendChild(linkItem);
|
||||||
|
|
||||||
|
return menuItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue