Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

add VUPBoundary VDOWNboundary options so that pull-refresh is possible when content didn't overflow wrapper #1013

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions build/iscroll-infinite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -276,7 +276,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -392,6 +395,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -492,7 +499,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -543,6 +558,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down
23 changes: 20 additions & 3 deletions build/iscroll-lite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -269,7 +269,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -359,6 +362,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -459,7 +466,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -504,6 +519,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down
23 changes: 20 additions & 3 deletions build/iscroll-probe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -275,7 +275,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -390,6 +393,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -490,7 +497,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -541,6 +556,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down
23 changes: 20 additions & 3 deletions build/iscroll-zoom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -278,7 +278,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -396,6 +399,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -496,7 +503,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -541,6 +556,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down
23 changes: 20 additions & 3 deletions build/iscroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -275,7 +275,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -387,6 +390,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -487,7 +494,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -532,6 +547,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down
21 changes: 19 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ function IScroll (el, options) {

HWCompositing: true,
useTransition: true,
useTransform: true
useTransform: true,

VUPBoundary:true, //true : respect v-boundary when not overflow, false: can scroll when not overflow
VDOWNboundary:true,
};

for ( var i in options ) {
Expand Down Expand Up @@ -113,6 +116,10 @@ IScroll.prototype = {
return;
}

if (this.isAnimating || this.isInTransition) {
e.preventDefault();
}

if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
Expand Down Expand Up @@ -213,7 +220,15 @@ IScroll.prototype = {
}

deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;

// Still scroll when wrapper is not over-flow by scroller
if(!this.options.VUPBoundary && deltaY < 0) {
deltaY = deltaY;
}else if(!this.options.VDOWNboundary && deltaY > 0) {
deltaY = deltaY;
}else {
deltaY = this.hasVerticalScroll ? deltaY : 0;
}

newX = this.x + deltaX;
newY = this.y + deltaY;
Expand Down Expand Up @@ -258,6 +273,8 @@ IScroll.prototype = {
e.preventDefault();
}

this._execEvent('touchEnd');

var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
Expand Down