guy 7 years ago
parent
commit
c26e8ccf94
  1. 50
      bi/widget.js
  2. 50
      dist/bundle.js
  3. 24
      dist/bundle.min.js
  4. 50
      dist/widget.js
  5. 11
      src/widget/adaptivearrangement/adaptivearrangement.js
  6. 39
      src/widget/arrangement/arrangement.js

50
bi/widget.js

@ -612,7 +612,8 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
left: [0, -1],
right: [0, 1]
};
var clientSize = this.element.bounds();
var clientWidth = this.arrangement.getClientWidth();
var clientHeight = this.arrangement.getClientHeight();
function scrollTo(direction, callback) {
if (direction === "") {
@ -667,7 +668,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("top", cb)
}
//向下滚
else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) {
else if (isBorderScroll && p.top >= clientHeight - 30 && p.top <= clientHeight) {
scrollTo("bottom", cb)
}
//向左滚
@ -675,20 +676,20 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("left", cb)
}
//向右滚
else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) {
else if (isBorderScroll && p.left >= clientWidth - 30 && p.left <= clientWidth) {
scrollTo("right", cb)
} else {
if (isOverflowScroll === true) {
if (p.top < 0) {
scrollTo("top", cb);
}
else if (p.top > clientSize.height) {
else if (p.top > clientHeight) {
scrollTo("bottom", cb);
}
else if (p.left < 0) {
scrollTo("left", cb);
}
else if (p.left > clientSize.width) {
else if (p.left > clientWidth) {
scrollTo("right", cb);
} else {
scrollTo("", cb);
@ -1071,12 +1072,30 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_applyRegion: function (regions) {
var self = this, o = this.options;
BI.each(regions || this.regions, function (i, region) {
region.el.element.css({
left: region.left,
top: region.top,
width: region.width,
height: region.height
});
if (region.el._left !== region.left) {
region.el.element.css({
left: region.left
});
region.el._left = region.left;
}
if (region.el._top !== region.top) {
region.el.element.css({
top: region.top
});
region.el._top = region.top;
}
if (region.el._width !== region.width) {
region.el.element.css({
width: region.width
});
region.el._width = region.left;
}
if (region.el._height !== region.height) {
region.el.element.css({
height: region.height
});
region.el._height = region.height;
}
});
this._applyContainer();
this.ratio = this.getLayoutRatio();
@ -1112,7 +1131,14 @@ BI.Arrangement = BI.inherit(BI.Widget, {
//先掩藏后显示能够明确滚动条是否出现
this.scrollContainer.element.css("overflow", "hidden");
var occupied = this._getRegionOccupied();
this.container.element.width(occupied.left + occupied.width).height(occupied.top + occupied.height);
if (this.container._width !== occupied.left + occupied.width) {
this.container.element.width(occupied.left + occupied.width);
this.container._width = occupied.left + occupied.width;
}
if (this.container._height !== occupied.top + occupied.height) {
this.container.element.height(occupied.top + occupied.height);
this.container._height = occupied.top + occupied.height;
}
this.scrollContainer.element.css("overflow", "auto");
return occupied;
},

50
dist/bundle.js vendored

@ -79139,7 +79139,8 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
left: [0, -1],
right: [0, 1]
};
var clientSize = this.element.bounds();
var clientWidth = this.arrangement.getClientWidth();
var clientHeight = this.arrangement.getClientHeight();
function scrollTo(direction, callback) {
if (direction === "") {
@ -79194,7 +79195,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("top", cb)
}
//向下滚
else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) {
else if (isBorderScroll && p.top >= clientHeight - 30 && p.top <= clientHeight) {
scrollTo("bottom", cb)
}
//向左滚
@ -79202,20 +79203,20 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("left", cb)
}
//向右滚
else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) {
else if (isBorderScroll && p.left >= clientWidth - 30 && p.left <= clientWidth) {
scrollTo("right", cb)
} else {
if (isOverflowScroll === true) {
if (p.top < 0) {
scrollTo("top", cb);
}
else if (p.top > clientSize.height) {
else if (p.top > clientHeight) {
scrollTo("bottom", cb);
}
else if (p.left < 0) {
scrollTo("left", cb);
}
else if (p.left > clientSize.width) {
else if (p.left > clientWidth) {
scrollTo("right", cb);
} else {
scrollTo("", cb);
@ -79598,12 +79599,30 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_applyRegion: function (regions) {
var self = this, o = this.options;
BI.each(regions || this.regions, function (i, region) {
region.el.element.css({
left: region.left,
top: region.top,
width: region.width,
height: region.height
});
if (region.el._left !== region.left) {
region.el.element.css({
left: region.left
});
region.el._left = region.left;
}
if (region.el._top !== region.top) {
region.el.element.css({
top: region.top
});
region.el._top = region.top;
}
if (region.el._width !== region.width) {
region.el.element.css({
width: region.width
});
region.el._width = region.left;
}
if (region.el._height !== region.height) {
region.el.element.css({
height: region.height
});
region.el._height = region.height;
}
});
this._applyContainer();
this.ratio = this.getLayoutRatio();
@ -79639,7 +79658,14 @@ BI.Arrangement = BI.inherit(BI.Widget, {
//先掩藏后显示能够明确滚动条是否出现
this.scrollContainer.element.css("overflow", "hidden");
var occupied = this._getRegionOccupied();
this.container.element.width(occupied.left + occupied.width).height(occupied.top + occupied.height);
if (this.container._width !== occupied.left + occupied.width) {
this.container.element.width(occupied.left + occupied.width);
this.container._width = occupied.left + occupied.width;
}
if (this.container._height !== occupied.top + occupied.height) {
this.container.element.height(occupied.top + occupied.height);
this.container._height = occupied.top + occupied.height;
}
this.scrollContainer.element.css("overflow", "auto");
return occupied;
},

24
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

50
dist/widget.js vendored

@ -612,7 +612,8 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
left: [0, -1],
right: [0, 1]
};
var clientSize = this.element.bounds();
var clientWidth = this.arrangement.getClientWidth();
var clientHeight = this.arrangement.getClientHeight();
function scrollTo(direction, callback) {
if (direction === "") {
@ -667,7 +668,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("top", cb)
}
//向下滚
else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) {
else if (isBorderScroll && p.top >= clientHeight - 30 && p.top <= clientHeight) {
scrollTo("bottom", cb)
}
//向左滚
@ -675,20 +676,20 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("left", cb)
}
//向右滚
else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) {
else if (isBorderScroll && p.left >= clientWidth - 30 && p.left <= clientWidth) {
scrollTo("right", cb)
} else {
if (isOverflowScroll === true) {
if (p.top < 0) {
scrollTo("top", cb);
}
else if (p.top > clientSize.height) {
else if (p.top > clientHeight) {
scrollTo("bottom", cb);
}
else if (p.left < 0) {
scrollTo("left", cb);
}
else if (p.left > clientSize.width) {
else if (p.left > clientWidth) {
scrollTo("right", cb);
} else {
scrollTo("", cb);
@ -1071,12 +1072,30 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_applyRegion: function (regions) {
var self = this, o = this.options;
BI.each(regions || this.regions, function (i, region) {
region.el.element.css({
left: region.left,
top: region.top,
width: region.width,
height: region.height
});
if (region.el._left !== region.left) {
region.el.element.css({
left: region.left
});
region.el._left = region.left;
}
if (region.el._top !== region.top) {
region.el.element.css({
top: region.top
});
region.el._top = region.top;
}
if (region.el._width !== region.width) {
region.el.element.css({
width: region.width
});
region.el._width = region.left;
}
if (region.el._height !== region.height) {
region.el.element.css({
height: region.height
});
region.el._height = region.height;
}
});
this._applyContainer();
this.ratio = this.getLayoutRatio();
@ -1112,7 +1131,14 @@ BI.Arrangement = BI.inherit(BI.Widget, {
//先掩藏后显示能够明确滚动条是否出现
this.scrollContainer.element.css("overflow", "hidden");
var occupied = this._getRegionOccupied();
this.container.element.width(occupied.left + occupied.width).height(occupied.top + occupied.height);
if (this.container._width !== occupied.left + occupied.width) {
this.container.element.width(occupied.left + occupied.width);
this.container._width = occupied.left + occupied.width;
}
if (this.container._height !== occupied.top + occupied.height) {
this.container.element.height(occupied.top + occupied.height);
this.container._height = occupied.top + occupied.height;
}
this.scrollContainer.element.css("overflow", "auto");
return occupied;
},

11
src/widget/adaptivearrangement/adaptivearrangement.js

@ -193,7 +193,8 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
left: [0, -1],
right: [0, 1]
};
var clientSize = this.element.bounds();
var clientWidth = this.arrangement.getClientWidth();
var clientHeight = this.arrangement.getClientHeight();
function scrollTo(direction, callback) {
if (direction === "") {
@ -248,7 +249,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("top", cb)
}
//向下滚
else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) {
else if (isBorderScroll && p.top >= clientHeight - 30 && p.top <= clientHeight) {
scrollTo("bottom", cb)
}
//向左滚
@ -256,20 +257,20 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
scrollTo("left", cb)
}
//向右滚
else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) {
else if (isBorderScroll && p.left >= clientWidth - 30 && p.left <= clientWidth) {
scrollTo("right", cb)
} else {
if (isOverflowScroll === true) {
if (p.top < 0) {
scrollTo("top", cb);
}
else if (p.top > clientSize.height) {
else if (p.top > clientHeight) {
scrollTo("bottom", cb);
}
else if (p.left < 0) {
scrollTo("left", cb);
}
else if (p.left > clientSize.width) {
else if (p.left > clientWidth) {
scrollTo("right", cb);
} else {
scrollTo("", cb);

39
src/widget/arrangement/arrangement.js

@ -272,12 +272,30 @@ BI.Arrangement = BI.inherit(BI.Widget, {
_applyRegion: function (regions) {
var self = this, o = this.options;
BI.each(regions || this.regions, function (i, region) {
region.el.element.css({
left: region.left,
top: region.top,
width: region.width,
height: region.height
});
if (region.el._left !== region.left) {
region.el.element.css({
left: region.left
});
region.el._left = region.left;
}
if (region.el._top !== region.top) {
region.el.element.css({
top: region.top
});
region.el._top = region.top;
}
if (region.el._width !== region.width) {
region.el.element.css({
width: region.width
});
region.el._width = region.left;
}
if (region.el._height !== region.height) {
region.el.element.css({
height: region.height
});
region.el._height = region.height;
}
});
this._applyContainer();
this.ratio = this.getLayoutRatio();
@ -313,7 +331,14 @@ BI.Arrangement = BI.inherit(BI.Widget, {
//先掩藏后显示能够明确滚动条是否出现
this.scrollContainer.element.css("overflow", "hidden");
var occupied = this._getRegionOccupied();
this.container.element.width(occupied.left + occupied.width).height(occupied.top + occupied.height);
if (this.container._width !== occupied.left + occupied.width) {
this.container.element.width(occupied.left + occupied.width);
this.container._width = occupied.left + occupied.width;
}
if (this.container._height !== occupied.top + occupied.height) {
this.container.element.height(occupied.top + occupied.height);
this.container._height = occupied.top + occupied.height;
}
this.scrollContainer.element.css("overflow", "auto");
return occupied;
},

Loading…
Cancel
Save