From 8f0e527980cc632103189f7dc49a675e3eb683dc Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 31 Mar 2017 10:55:12 +0800 Subject: [PATCH] add --- bi/core.js | 50 ++++++++++++---------- dist/core.js | 50 ++++++++++++---------- src/core/controller/controller.floatbox.js | 50 ++++++++++++---------- 3 files changed, 81 insertions(+), 69 deletions(-) diff --git a/bi/core.js b/bi/core.js index 5e5a78631c..05d821f9b1 100644 --- a/bi/core.js +++ b/bi/core.js @@ -15684,28 +15684,30 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); - this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; - this.modal && container.element.__buildZIndexMask__(this.zindex++); - this.get(name).setZindex(this.zindex++); - this.floatContainer[name].visible(); - var floatbox = this.get(name); - floatbox.show(); - var W = $(this.options.render).width(), H = $(this.options.render).height(); - var w = floatbox.element.width(), h = floatbox.element.height(); - var left = (W - w) / 2, top = (H - h) / 2; - if (left < 0) { - left = 0; - } - if (top < 0) { - top = 0; + if (!this.floatContainer[name].isVisible()) { + var container = this.floatContainer[name]; + container.element.css("zIndex", this.zindex++); + this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); + this.zindexMap[name] = this.zindex; + this.modal && container.element.__buildZIndexMask__(this.zindex++); + this.get(name).setZindex(this.zindex++); + this.floatContainer[name].visible(); + var floatbox = this.get(name); + floatbox.show(); + var W = $(this.options.render).width(), H = $(this.options.render).height(); + var w = floatbox.element.width(), h = floatbox.element.height(); + var left = (W - w) / 2, top = (H - h) / 2; + if (left < 0) { + left = 0; + } + if (top < 0) { + top = 0; + } + floatbox.element.css({ + left: left + "px", + top: top + "px" + }); } - floatbox.element.css({ - left: left + "px", - top: top + "px" - }); return this; }, @@ -15713,8 +15715,10 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - this.floatContainer[name].invisible(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + if (this.floatContainer[name].isVisible()) { + this.floatContainer[name].invisible(); + this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + } return this; }, diff --git a/dist/core.js b/dist/core.js index 34490f02e5..ee87da9609 100644 --- a/dist/core.js +++ b/dist/core.js @@ -20757,28 +20757,30 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); - this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; - this.modal && container.element.__buildZIndexMask__(this.zindex++); - this.get(name).setZindex(this.zindex++); - this.floatContainer[name].visible(); - var floatbox = this.get(name); - floatbox.show(); - var W = $(this.options.render).width(), H = $(this.options.render).height(); - var w = floatbox.element.width(), h = floatbox.element.height(); - var left = (W - w) / 2, top = (H - h) / 2; - if (left < 0) { - left = 0; - } - if (top < 0) { - top = 0; + if (!this.floatContainer[name].isVisible()) { + var container = this.floatContainer[name]; + container.element.css("zIndex", this.zindex++); + this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); + this.zindexMap[name] = this.zindex; + this.modal && container.element.__buildZIndexMask__(this.zindex++); + this.get(name).setZindex(this.zindex++); + this.floatContainer[name].visible(); + var floatbox = this.get(name); + floatbox.show(); + var W = $(this.options.render).width(), H = $(this.options.render).height(); + var w = floatbox.element.width(), h = floatbox.element.height(); + var left = (W - w) / 2, top = (H - h) / 2; + if (left < 0) { + left = 0; + } + if (top < 0) { + top = 0; + } + floatbox.element.css({ + left: left + "px", + top: top + "px" + }); } - floatbox.element.css({ - left: left + "px", - top: top + "px" - }); return this; }, @@ -20786,8 +20788,10 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - this.floatContainer[name].invisible(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + if (this.floatContainer[name].isVisible()) { + this.floatContainer[name].invisible(); + this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + } return this; }, diff --git a/src/core/controller/controller.floatbox.js b/src/core/controller/controller.floatbox.js index 3179694817..b06e9723b0 100644 --- a/src/core/controller/controller.floatbox.js +++ b/src/core/controller/controller.floatbox.js @@ -82,28 +82,30 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); - this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; - this.modal && container.element.__buildZIndexMask__(this.zindex++); - this.get(name).setZindex(this.zindex++); - this.floatContainer[name].visible(); - var floatbox = this.get(name); - floatbox.show(); - var W = $(this.options.render).width(), H = $(this.options.render).height(); - var w = floatbox.element.width(), h = floatbox.element.height(); - var left = (W - w) / 2, top = (H - h) / 2; - if (left < 0) { - left = 0; + if (!this.floatContainer[name].isVisible()) { + var container = this.floatContainer[name]; + container.element.css("zIndex", this.zindex++); + this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); + this.zindexMap[name] = this.zindex; + this.modal && container.element.__buildZIndexMask__(this.zindex++); + this.get(name).setZindex(this.zindex++); + this.floatContainer[name].visible(); + var floatbox = this.get(name); + floatbox.show(); + var W = $(this.options.render).width(), H = $(this.options.render).height(); + var w = floatbox.element.width(), h = floatbox.element.height(); + var left = (W - w) / 2, top = (H - h) / 2; + if (left < 0) { + left = 0; + } + if (top < 0) { + top = 0; + } + floatbox.element.css({ + left: left + "px", + top: top + "px" + }); } - if (top < 0) { - top = 0; - } - floatbox.element.css({ - left: left + "px", - top: top + "px" - }); return this; }, @@ -111,8 +113,10 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { if (!this._check(name)) { return this; } - this.floatContainer[name].invisible(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + if (this.floatContainer[name].isVisible()) { + this.floatContainer[name].invisible(); + this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); + } return this; },