1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-03-30 22:00:05 -04:00
parent 55511e7c07
commit 638a360cb2
11 changed files with 115 additions and 19 deletions

View file

@ -85,8 +85,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_bringOverlayAtIndexToFront: function(i) {
var overlay = this._overlays[i];
var lastI = this._overlays.length - 1;
// Ensure always-on-top overlay stays on top.
if (!overlay.alwaysOnTop && this._overlays[lastI].alwaysOnTop) {
lastI--;
}
// If already the top element, return.
if (!overlay || i === lastI) {
if (!overlay || i >= lastI) {
return;
}
// Update z-index to be on top.
@ -119,6 +123,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Tracks overlays for z-index and focus management.
* Ensures the last added overlay with always-on-top remains on top.
* @param {Element} overlay
*/
addOverlay: function(overlay) {
@ -127,12 +132,28 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this._bringOverlayAtIndexToFront(i);
return;
}
var minimumZ = Math.max(this.currentOverlayZ(), this._minimumZ);
this._overlays.push(overlay);
var newZ = this.currentOverlayZ();
var insertionIndex = this._overlays.length;
var currentOverlay = this._overlays[insertionIndex - 1];
var minimumZ = Math.max(this._getZ(currentOverlay), this._minimumZ);
var newZ = this._getZ(overlay);
// Ensure always-on-top overlay stays on top.
if (currentOverlay && currentOverlay.alwaysOnTop && !overlay.alwaysOnTop) {
// This bumps the z-index of +2.
this._applyOverlayZ(currentOverlay, minimumZ);
insertionIndex--;
// Update minimumZ to match previous overlay's z-index.
var previousOverlay = this._overlays[insertionIndex - 1];
minimumZ = Math.max(this._getZ(previousOverlay), this._minimumZ);
}
// Update z-index and insert overlay.
if (newZ <= minimumZ) {
this._applyOverlayZ(overlay, minimumZ);
}
this._overlays.splice(insertionIndex, 0, overlay);
// Get focused node.
var element = this.deepActiveElement;
overlay.restoreFocusNode = this._overlayParent(element) ? null : element;
},