Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
adjust resonable options for disablePointer/Touch/Mouse
Browse files Browse the repository at this point in the history
if browser doesn't have events, a default value of disablePointer/Touch/Mouse options is 'true'
- change default value about disablePointer,disableTouch, disableMouse options
- don't attach unnesassray events.
- fix two click/tap issue.

Close cubiq#361
  • Loading branch information
sculove authored and aisouard committed Feb 21, 2017
1 parent 628b251 commit d1ad849
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
8 changes: 5 additions & 3 deletions build/iscroll-infinite.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var utils = (function () {

me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};

Expand Down Expand Up @@ -86,7 +86,7 @@ var utils = (function () {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});

Expand Down Expand Up @@ -285,7 +285,9 @@ function IScroll (el, options) {
deceleration: 0.004,

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down
8 changes: 5 additions & 3 deletions build/iscroll-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var utils = (function () {

me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};

Expand Down Expand Up @@ -86,7 +86,7 @@ var utils = (function () {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});

Expand Down Expand Up @@ -278,7 +278,9 @@ function IScroll (el, options) {
this.options = {

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down
8 changes: 5 additions & 3 deletions build/iscroll-probe.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var utils = (function () {

me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};

Expand Down Expand Up @@ -86,7 +86,7 @@ var utils = (function () {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});

Expand Down Expand Up @@ -284,7 +284,9 @@ function IScroll (el, options) {
snapThreshold: 0.334,

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down
8 changes: 5 additions & 3 deletions build/iscroll-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var utils = (function () {

me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};

Expand Down Expand Up @@ -86,7 +86,7 @@ var utils = (function () {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});

Expand Down Expand Up @@ -287,7 +287,9 @@ function IScroll (el, options) {
snapThreshold: 0.334,

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down
8 changes: 5 additions & 3 deletions build/iscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var utils = (function () {

me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
pointerEvent;
};

Expand Down Expand Up @@ -86,7 +86,7 @@ var utils = (function () {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});

Expand Down Expand Up @@ -284,7 +284,9 @@ function IScroll (el, options) {
snapThreshold: 0.334,

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down
4 changes: 3 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function IScroll (el, options) {
this.options = {

// INSERT POINT: OPTIONS

disablePointer : !utils.hasPointer,
disableTouch : utils.hasPointer || !utils.hasTouch,
disableMouse : utils.hasPointer || utils.hasTouch,
startX: 0,
startY: 0,
scrollY: true,
Expand Down

0 comments on commit d1ad849

Please sign in to comment.