From a9d69a4aa251cd6134e4dd5629345a1289656521 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 19 Nov 2021 10:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EDrawer=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=92=8Cpopover=E4=B8=80=E6=A0=B7?= =?UTF-8?q?=E7=9A=84zindex=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/controller/controller.drawer.js | 10 +++++----- src/core/controller/controller.popover.js | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/controller/controller.drawer.js b/src/core/controller/controller.drawer.js index 1b7bae664..68fdadbc8 100644 --- a/src/core/controller/controller.drawer.js +++ b/src/core/controller/controller.drawer.js @@ -18,7 +18,6 @@ BI.DrawerController = BI.inherit(BI.Controller, { this.floatLayer = {}; this.floatContainer = {}; this.floatOpened = {}; - this.zindex = BI.zIndex_popover; this.zindexMap = {}; }, @@ -41,17 +40,18 @@ BI.DrawerController = BI.inherit(BI.Controller, { if (!this.floatOpened[name]) { this.floatOpened[name] = true; var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); + var zIndex = BI.Popovers._getZIndex(); + container.element.css("zIndex", zIndex); this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; + this.zindexMap[name] = zIndex; if (this.modal) { - var mask = container.element.__buildZIndexMask__(this.zindex++); + var mask = container.element.__buildZIndexMask__(BI.Popovers._getZIndex()); mask.click(function () { mask.destroy(); self.get(name).close(); }); } - this.get(name).setZindex(this.zindex++); + this.get(name).setZindex(BI.Popovers._getZIndex()); this.floatContainer[name].visible(); var popover = this.get(name); popover.show && popover.show(); diff --git a/src/core/controller/controller.popover.js b/src/core/controller/controller.popover.js index fbe7e29d9..83f1e8d5c 100644 --- a/src/core/controller/controller.popover.js +++ b/src/core/controller/controller.popover.js @@ -48,7 +48,8 @@ BI.PopoverController = BI.inherit(BI.Controller, { this.floatContainer[name].visible(); var popover = this.get(name); popover.show && popover.show(); - var W = BI.Widget._renderEngine.createElement(this.options.render).width(), H = BI.Widget._renderEngine.createElement(this.options.render).height(); + var W = BI.Widget._renderEngine.createElement(this.options.render).width(), + H = BI.Widget._renderEngine.createElement(this.options.render).height(); var w = popover.element.width(), h = popover.element.height(); var left = (W - w) / 2, top = (H - h) / 2; if (left < 0) { @@ -163,5 +164,9 @@ BI.PopoverController = BI.inherit(BI.Controller, { this.floatOpened = {}; this.zindexMap = {}; return this; + }, + + _getZIndex: function () { + return this.zindex++; } });