From c528ce12c6bc75be64b8cf10bf96f76ea088cdc5 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 24 Jun 2017 02:11:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/widget.js | 25 +++++++++---------- docs/widget.js | 25 +++++++++---------- .../adaptivearrangement.js | 4 +-- src/widget/arrangement/arrangement.js | 21 ++++++++-------- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/bi/widget.js b/bi/widget.js index 0c000ac30..5089b1e72 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -458,9 +458,9 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { self._initResizable(item.el); }); - this.element.mousedown(function (e) { + $(document).mousedown(function (e) { BI.each(self.getAllRegions(), function (i, region) { - if (!region.el.element.__isMouseInBounds__(e)) { + if (region.el.element.find(e.target).length === 0) { region.el.element.removeClass("selected"); } }); @@ -1160,15 +1160,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { var leftPortion = Math.round(position.left / perWidth); var topPortion = Math.round(position.top / perHeight); var heightPortion = Math.round(position.height / perHeight); - if (leftPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION; - } - if (widthPortion > BI.Arrangement.PORTION) { - widthPortion = BI.Arrangement.PORTION; - } - if (leftPortion + widthPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION - widthPortion; - } + // if (leftPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION; + // } + // if (widthPortion > BI.Arrangement.PORTION) { + // widthPortion = BI.Arrangement.PORTION; + // } + // if (leftPortion + widthPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION - widthPortion; + // } if (widthPortion === 0) { widthPortion = 1; } @@ -1735,7 +1735,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { resize: function () { var self = this, o = this.options; - var occupied = this._applyContainer(); switch (o.layoutType) { case BI.Arrangement.LAYOUT_TYPE.FREE: break; @@ -1828,7 +1827,7 @@ BI.Arrangement = BI.inherit(BI.Widget, { }); BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.extend(BI.Arrangement, { - PORTION: 32, + PORTION: 36, H_PORTION: 18, LAYOUT_TYPE: { GRID: 0, diff --git a/docs/widget.js b/docs/widget.js index 0c000ac30..5089b1e72 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -458,9 +458,9 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { self._initResizable(item.el); }); - this.element.mousedown(function (e) { + $(document).mousedown(function (e) { BI.each(self.getAllRegions(), function (i, region) { - if (!region.el.element.__isMouseInBounds__(e)) { + if (region.el.element.find(e.target).length === 0) { region.el.element.removeClass("selected"); } }); @@ -1160,15 +1160,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { var leftPortion = Math.round(position.left / perWidth); var topPortion = Math.round(position.top / perHeight); var heightPortion = Math.round(position.height / perHeight); - if (leftPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION; - } - if (widthPortion > BI.Arrangement.PORTION) { - widthPortion = BI.Arrangement.PORTION; - } - if (leftPortion + widthPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION - widthPortion; - } + // if (leftPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION; + // } + // if (widthPortion > BI.Arrangement.PORTION) { + // widthPortion = BI.Arrangement.PORTION; + // } + // if (leftPortion + widthPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION - widthPortion; + // } if (widthPortion === 0) { widthPortion = 1; } @@ -1735,7 +1735,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { resize: function () { var self = this, o = this.options; - var occupied = this._applyContainer(); switch (o.layoutType) { case BI.Arrangement.LAYOUT_TYPE.FREE: break; @@ -1828,7 +1827,7 @@ BI.Arrangement = BI.inherit(BI.Widget, { }); BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.extend(BI.Arrangement, { - PORTION: 32, + PORTION: 36, H_PORTION: 18, LAYOUT_TYPE: { GRID: 0, diff --git a/src/widget/adaptivearrangement/adaptivearrangement.js b/src/widget/adaptivearrangement/adaptivearrangement.js index d14817e96..0891d19a9 100644 --- a/src/widget/adaptivearrangement/adaptivearrangement.js +++ b/src/widget/adaptivearrangement/adaptivearrangement.js @@ -39,9 +39,9 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, { self._initResizable(item.el); }); - this.element.mousedown(function (e) { + $(document).mousedown(function (e) { BI.each(self.getAllRegions(), function (i, region) { - if (!region.el.element.__isMouseInBounds__(e)) { + if (region.el.element.find(e.target).length === 0) { region.el.element.removeClass("selected"); } }); diff --git a/src/widget/arrangement/arrangement.js b/src/widget/arrangement/arrangement.js index d429eeb29..57cc8db5b 100644 --- a/src/widget/arrangement/arrangement.js +++ b/src/widget/arrangement/arrangement.js @@ -366,15 +366,15 @@ BI.Arrangement = BI.inherit(BI.Widget, { var leftPortion = Math.round(position.left / perWidth); var topPortion = Math.round(position.top / perHeight); var heightPortion = Math.round(position.height / perHeight); - if (leftPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION; - } - if (widthPortion > BI.Arrangement.PORTION) { - widthPortion = BI.Arrangement.PORTION; - } - if (leftPortion + widthPortion > BI.Arrangement.PORTION) { - leftPortion = BI.Arrangement.PORTION - widthPortion; - } + // if (leftPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION; + // } + // if (widthPortion > BI.Arrangement.PORTION) { + // widthPortion = BI.Arrangement.PORTION; + // } + // if (leftPortion + widthPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION - widthPortion; + // } if (widthPortion === 0) { widthPortion = 1; } @@ -941,7 +941,6 @@ BI.Arrangement = BI.inherit(BI.Widget, { resize: function () { var self = this, o = this.options; - var occupied = this._applyContainer(); switch (o.layoutType) { case BI.Arrangement.LAYOUT_TYPE.FREE: break; @@ -1034,7 +1033,7 @@ BI.Arrangement = BI.inherit(BI.Widget, { }); BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; BI.extend(BI.Arrangement, { - PORTION: 32, + PORTION: 36, H_PORTION: 18, LAYOUT_TYPE: { GRID: 0,