Skip to content

Commit 91bc347

Browse files
committed
More work
1 parent 6a363a7 commit 91bc347

2 files changed

Lines changed: 79 additions & 14 deletions

File tree

beta/emuos/assets/js/window.js

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,16 @@
356356
// github.com/jquery/jquery-ui/commit/acfda4be521e48c6b61cc458a715ef163892ac36
357357
// window has it's own flow of z-indexes, so we revert z-index
358358
// value and use native flow manager instead
359-
if (this.overlay) {
359+
if (this.options.modal) {
360+
if (this.overlay) {
361+
this.overlay.css('zIndex', '');
362+
}
363+
364+
this._modalZIndexes({
365+
revertActive: false
366+
});
367+
this.moveToTop(null, true);
368+
} else if (this.overlay) {
360369
this.overlay.css('zIndex', '');
361370
this.moveToTop(null, true);
362371
}
@@ -1289,12 +1298,20 @@
12891298

12901299
// this._afterConfirmCloseButtonsBuild();
12911300

1292-
this._removeTopClasses();
1293-
this.$helpWindow.window('moveToTop');
1301+
var $helpWindowParent = this.$helpWindow.parent();
1302+
var helpInstance = this.$helpWindow.data(this._cnst.dataPrefix + 'window');
1303+
1304+
this._removeTopClasses($('.' + this.classes.window).not($helpWindowParent));
1305+
1306+
if (helpInstance) {
1307+
helpInstance._modalZIndexes({
1308+
revertActive: false
1309+
});
1310+
helpInstance._setTopClasses($helpWindowParent);
1311+
}
12941312

12951313
// position window on the center of it's parent window
1296-
var $helpWindowParent = this.$helpWindow.parent(),
1297-
taskbar = this._getTaskbarInstance(),
1314+
var taskbar = this._getTaskbarInstance(),
12981315
pd = taskbar._extendedPosition.call($helpWindowParent, 'offset'),
12991316
wd = taskbar._extendedPosition.call(this.$elem, 'offset'),
13001317
css = {},
@@ -1664,9 +1681,11 @@
16641681

16651682
this['$' + b] = $('<button></button>').button({showLabel: false}).attr('data-button-name', b).addClass(this.classes['button' + B] + ' ' + this.classes.button).on({
16661683
click: function() {
1684+
var helpOpened = false;
1685+
16671686
// trigger action
16681687
if (b === 'help') {
1669-
self._openHelp();
1688+
helpOpened = self._openHelp();
16701689
}
16711690

16721691
if (b === 'newtab') {
@@ -1687,7 +1706,7 @@
16871706

16881707
if (b === 'minimize') {
16891708
this.blur();
1690-
} else {
1709+
} else if (!helpOpened) {
16911710
self.moveToTop();
16921711
}
16931712
},
@@ -1816,12 +1835,20 @@
18161835
});
18171836
});
18181837

1819-
// set new z-indexes
1838+
// set new z-indexes; skip windows managed by modal overlay logic
18201839
$.each(windows, function(index, set) {
1840+
if (self._isCoveredByModalOverlay(set[1])) {
1841+
return;
1842+
}
1843+
18211844
set[1].css('zIndex', initialZIndex);
18221845
initialZIndex++;
18231846
});
18241847

1848+
if ($modal.length || this.options.modal) {
1849+
this._refreshActiveModalZIndexes($modal.add(this.options.modal ? this.$elem : $()));
1850+
}
1851+
18251852
var move;
18261853

18271854
if ($elem instanceof $) {
@@ -3388,20 +3415,23 @@
33883415
set.call(this, true);
33893416
});
33903417

3391-
$setCover = this._sortByZIndex($setCover, 'desc');
3392-
var zIndexDown = zIndex;
3418+
var taskbar = this._getTaskbarInstance();
3419+
var baseZ = taskbar ? taskbar.options.windowsInitialZIndex : this._cnst.lowestPossibleZIndex;
3420+
3421+
$setCover = this._sortByZIndex($setCover, 'asc');
33933422

33943423
$setCover.each(function() {
3395-
$(this).css('zIndex', --zIndexDown);
3424+
$(this).css('zIndex', baseZ++);
33963425
});
3426+
3427+
zIndex = baseZ - 1;
33973428
}
33983429

33993430
// noinspection JSUnusedGlobalSymbols
34003431
this.$overlaySet = $setCover;
34013432

34023433
if (!this.overlay) {
34033434
this._createOverlay();
3404-
this._hideOverlay(false);
34053435
}
34063436

34073437
if (zIndex === this._cnst.lowestPossibleZIndex) {
@@ -3425,6 +3455,11 @@
34253455
}
34263456

34273457
this.$elem.css('zIndex', ++zIndex);
3458+
this._showOverlay();
3459+
},
3460+
3461+
_isCoveredByModalOverlay: function($elem) {
3462+
return $elem.is('[class*="' + this.classes.coveredByOverlay + '"]');
34283463
},
34293464

34303465
_modalZIndexes: function(options) {
@@ -3436,6 +3471,25 @@
34363471
this._setModalZIndexes();
34373472
},
34383473

3474+
_refreshActiveModalZIndexes: function($modals) {
3475+
var self = this;
3476+
var $targetModals = $modals.filter('.' + this.classes.windowTop);
3477+
3478+
if (!$targetModals.length) {
3479+
$targetModals = $modals;
3480+
}
3481+
3482+
$targetModals.each(function() {
3483+
var instance = $(this).children('.' + self.classes.windowContent).data(self._cnst.dataPrefix + 'window');
3484+
3485+
if (instance && instance.options.modal) {
3486+
instance._modalZIndexes({
3487+
revertActive: false
3488+
});
3489+
}
3490+
});
3491+
},
3492+
34393493
_revertModalZIndexes: function(force) {
34403494
if (!this.options.modal) {
34413495
return;
@@ -3593,7 +3647,17 @@
35933647
return;
35943648
}
35953649

3596-
var opacity = this._getTaskbarInstance()._styleIndicator(this.classes.uiWidgetOverlay, 'opacity').opacity;
3650+
var taskbar = this._getTaskbarInstance();
3651+
var opacity = taskbar._styleIndicator(this.classes.dialogOverlay + ' ' + this.classes.uiWidgetOverlay, 'opacity').opacity;
3652+
3653+
if (!opacity || parseFloat(opacity, 10) < 0.01) {
3654+
opacity = taskbar._styleIndicator(this.classes.uiWidgetOverlay, 'opacity').opacity;
3655+
}
3656+
3657+
if (!opacity || parseFloat(opacity, 10) < 0.01) {
3658+
opacity = 0.3;
3659+
}
3660+
35973661
this.overlay.show().stop(false, true);
35983662

35993663
var props = {

beta/emuos/assets/styles/css/themes/basic/window.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@
143143
}
144144

145145
.emuos-window-dialog-overlay.ui-widget-overlay {
146-
background-repeat: repeat;
146+
background: #000;
147+
opacity: .3;
147148
}
148149

149150
/* for consistency, those two classes shouldn't have diffrenct transition times */

0 commit comments

Comments
 (0)