mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Scroll size limit
This commit is contained in:
@ -121,12 +121,12 @@
|
||||
|
||||
window.requestAnimationFrame(function() {
|
||||
var totalWidth = _this.el.scrollWidth;
|
||||
var totalHeight = _this.el.offsetHeight;
|
||||
var totalHeight = _this.el.scrollHeight;
|
||||
var parentWidth = _this.el.parentNode.offsetWidth;
|
||||
var parentHeight = _this.el.parentNode.offsetHeight;
|
||||
|
||||
var maxX = (-totalWidth + parentWidth);
|
||||
var maxY = (-totalHeight + parentHeight);
|
||||
var maxX = Math.min(0, (-totalWidth + parentWidth));
|
||||
var maxY = Math.min(0, (-totalHeight + parentHeight));
|
||||
|
||||
//this._execEvent('scrollEnd');
|
||||
var x = _this.x, y = _this.y;
|
||||
@ -160,7 +160,7 @@
|
||||
|
||||
var totalHeight = this.el.offsetHeight;
|
||||
var parentHeight = this.el.parentNode.offsetHeight;
|
||||
var maxY = totalHeight - parentHeight;
|
||||
var maxY = Math.max(0, totalHeight - parentHeight);
|
||||
var maxX = 0;
|
||||
|
||||
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
|
||||
@ -287,6 +287,19 @@
|
||||
var scrollLeft = parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
||||
var scrollTop = parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[1]) || 0;
|
||||
|
||||
var totalWidth = this.el.scrollWidth;
|
||||
var totalHeight = this.el.scrollHeight;
|
||||
var parentWidth = this.el.parentNode.offsetWidth;
|
||||
var parentHeight = this.el.parentNode.offsetHeight;
|
||||
|
||||
var maxX = Math.min(0, (-totalWidth + parentWidth));
|
||||
var maxY = Math.min(0, (-totalHeight + parentHeight));
|
||||
|
||||
// Check if we even have enough content to scroll, if not, don't start the drag
|
||||
if((this.isHorizontalEnabled && maxX == 0) || (this.isVerticalEnabled && maxY == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.x = scrollLeft;
|
||||
this.y = scrollTop;
|
||||
|
||||
@ -323,6 +336,7 @@
|
||||
// We really aren't dragging
|
||||
if(!_this._drag) {
|
||||
_this._startDrag(e);
|
||||
if(!_this._drag) { return; }
|
||||
}
|
||||
|
||||
// Stop any default events during the drag
|
||||
@ -355,9 +369,11 @@
|
||||
// We are dragging, grab the current content height
|
||||
|
||||
var totalWidth = _this.el.scrollWidth;
|
||||
var totalHeight = _this.el.offsetHeight;
|
||||
var totalHeight = _this.el.scrollHeight;
|
||||
var parentWidth = _this.el.parentNode.offsetWidth;
|
||||
var parentHeight = _this.el.parentNode.offsetHeight;
|
||||
var maxX = Math.min(0, (-totalWidth + parentWidth));
|
||||
var maxY = Math.min(0, (-totalHeight + parentHeight));
|
||||
|
||||
// Grab current timestamp to keep our speend, etc.
|
||||
// calculations in a window
|
||||
|
||||
Reference in New Issue
Block a user