Comparing version 0.3.1 to 0.4.0
@@ -25,4 +25,2 @@ /* | ||
*/ | ||
import raf from 'raf'; | ||
var desiredFrames = 60; | ||
@@ -38,2 +36,33 @@ var millisecondsPerSecond = 1000; | ||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | ||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | ||
// requestAnimationFrame polyfill by Erik Möller | ||
// fixes from Paul Irish and Tino Zijdel | ||
(function () { | ||
var lastTime = 0; | ||
var vendors = ['ms', 'moz', 'webkit', 'o']; | ||
for (var x = 0; x < vendors.length && !win.requestAnimationFrame; ++x) { | ||
win.requestAnimationFrame = win[vendors[x] + 'RequestAnimationFrame']; | ||
win.cancelAnimationFrame = win[vendors[x] + 'CancelAnimationFrame'] || win[vendors[x] + 'CancelRequestAnimationFrame']; | ||
} | ||
if (!win.requestAnimationFrame) { | ||
win.requestAnimationFrame = function (callback) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = win.setTimeout(function () { | ||
callback(currTime + timeToCall); | ||
}, timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
} | ||
if (!win.cancelAnimationFrame) { | ||
win.cancelAnimationFrame = function (id) { | ||
clearTimeout(id); | ||
}; | ||
} | ||
})(); | ||
var Animate = { | ||
@@ -137,3 +166,3 @@ /** | ||
lastFrame = now; | ||
raf(step); | ||
win.requestAnimationFrame(step); | ||
} | ||
@@ -146,3 +175,3 @@ }; | ||
// Init first step | ||
raf(step); | ||
win.requestAnimationFrame(step); | ||
@@ -149,0 +178,0 @@ // Return unique animation ID |
@@ -18,2 +18,17 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var supportsPassive = false; | ||
try { | ||
var opts = Object.defineProperty({}, 'passive', { | ||
get: function get() { | ||
supportsPassive = true; | ||
} | ||
}); | ||
window.addEventListener('test', null, opts); | ||
} catch (e) { | ||
// empty | ||
} | ||
var willPreventDefault = supportsPassive ? { passive: false } : false; | ||
var willNotPreventDefault = supportsPassive ? { passive: true } : false; | ||
function DOMScroller(content) { | ||
@@ -34,3 +49,3 @@ var _this = this; | ||
this.content = content; | ||
this.container = content.parentNode; | ||
var container = this.container = content.parentNode; | ||
this.options = _extends({}, options, { | ||
@@ -78,3 +93,3 @@ scrollingComplete: function scrollingComplete() { | ||
indicatorsPos[k] = 0; | ||
_this.container.appendChild(scrollbars[k]); | ||
container.appendChild(scrollbars[k]); | ||
} | ||
@@ -153,9 +168,12 @@ }); | ||
DOMScroller.prototype.setIndicatorPos = function setIndicatorPos(axis, value) { | ||
if (this.indicatorsPos[axis] !== value) { | ||
var indicatorsPos = this.indicatorsPos, | ||
indicators = this.indicators; | ||
if (indicatorsPos[axis] !== value) { | ||
if (axis === 'x') { | ||
setTransform(this.indicators[axis].style, 'translate3d(' + value + 'px,0,0)'); | ||
setTransform(indicators[axis].style, 'translate3d(' + value + 'px,0,0)'); | ||
} else { | ||
setTransform(this.indicators[axis].style, 'translate3d(0, ' + value + 'px,0)'); | ||
setTransform(indicators[axis].style, 'translate3d(0, ' + value + 'px,0)'); | ||
} | ||
this.indicatorsPos[axis] = value; | ||
indicatorsPos[axis] = value; | ||
} | ||
@@ -165,5 +183,8 @@ }; | ||
DOMScroller.prototype.setIndicatorSize = function setIndicatorSize(axis, value) { | ||
if (this.indicatorsSize[axis] !== value) { | ||
this.indicators[axis].style[axis === 'x' ? 'width' : 'height'] = value + 'px'; | ||
this.indicatorsSize[axis] = value; | ||
var indicatorsSize = this.indicatorsSize, | ||
indicators = this.indicators; | ||
if (indicatorsSize[axis] !== value) { | ||
indicators[axis].style[axis === 'x' ? 'width' : 'height'] = value + 'px'; | ||
indicatorsSize[axis] = value; | ||
} | ||
@@ -173,20 +194,27 @@ }; | ||
DOMScroller.prototype.reflow = function reflow() { | ||
if (this.scrollbars) { | ||
this.contentSize.x = this.content.offsetWidth; | ||
this.contentSize.y = this.content.offsetHeight; | ||
this.clientSize.x = this.container.clientWidth; | ||
this.clientSize.y = this.container.clientHeight; | ||
if (this.scrollbars.x) { | ||
this.scrollbarsSize.x = this.scrollbars.x.offsetWidth; | ||
var container = this.container, | ||
content = this.content, | ||
scrollbarsSize = this.scrollbarsSize, | ||
contentSize = this.contentSize, | ||
scrollbars = this.scrollbars, | ||
clientSize = this.clientSize; | ||
if (scrollbars) { | ||
contentSize.x = content.offsetWidth; | ||
contentSize.y = content.offsetHeight; | ||
clientSize.x = container.clientWidth; | ||
clientSize.y = container.clientHeight; | ||
if (scrollbars.x) { | ||
scrollbarsSize.x = scrollbars.x.offsetWidth; | ||
} | ||
if (this.scrollbars.y) { | ||
this.scrollbarsSize.y = this.scrollbars.y.offsetHeight; | ||
if (scrollbars.y) { | ||
scrollbarsSize.y = scrollbars.y.offsetHeight; | ||
} | ||
} | ||
// set the right scroller dimensions | ||
this.scroller.setDimensions(this.container.clientWidth, this.container.clientHeight, this.content.offsetWidth, this.content.offsetHeight); | ||
this.scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight); | ||
// refresh the position for zooming purposes | ||
var rect = this.container.getBoundingClientRect(); | ||
this.scroller.setPosition(rect.x + this.container.clientLeft, rect.y + this.container.clientTop); | ||
var rect = container.getBoundingClientRect(); | ||
this.scroller.setPosition(rect.x + container.clientLeft, rect.y + container.clientTop); | ||
}; | ||
@@ -196,11 +224,13 @@ | ||
this._destroyed = true; | ||
var container = this.container; | ||
window.removeEventListener('resize', this.onResize, false); | ||
this.container.removeEventListener('touchstart', this.onTouchStart, false); | ||
this.container.removeEventListener('touchmove', this.onTouchMove, false); | ||
this.container.removeEventListener('touchend', this.onTouchEnd, false); | ||
this.container.removeEventListener('touchcancel', this.onTouchCancel, false); | ||
this.container.removeEventListener('mousedown', this.onMouseDown, false); | ||
container.removeEventListener('touchstart', this.onTouchStart, false); | ||
container.removeEventListener('touchmove', this.onTouchMove, false); | ||
container.removeEventListener('touchend', this.onTouchEnd, false); | ||
container.removeEventListener('touchcancel', this.onTouchCancel, false); | ||
container.removeEventListener('mousedown', this.onMouseDown, false); | ||
document.removeEventListener('mousemove', this.onMouseMove, false); | ||
document.removeEventListener('mouseup', this.onMouseUp, false); | ||
this.container.removeEventListener('mousewheel', this.onMouseWheel, false); | ||
container.removeEventListener('mousewheel', this.onMouseWheel, false); | ||
}; | ||
@@ -211,7 +241,5 @@ | ||
var that = this; | ||
// reflow handling | ||
window.addEventListener('resize', this.onResize = function () { | ||
that.reflow(); | ||
_this2.reflow(); | ||
}, false); | ||
@@ -222,3 +250,6 @@ | ||
this.container.addEventListener('touchstart', this.onTouchStart = function (e) { | ||
var container = this.container; | ||
container.addEventListener('touchstart', this.onTouchStart = function (e) { | ||
lockMouse = true; | ||
@@ -235,29 +266,36 @@ if (releaseLockTimer) { | ||
// reflow since the container may have changed | ||
that.reflow(); | ||
that.scroller.doTouchStart(e.touches, e.timeStamp); | ||
}, false); | ||
_this2.reflow(); | ||
_this2.scroller.doTouchStart(e.touches, e.timeStamp); | ||
}, willNotPreventDefault); | ||
this.container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
if (_this2.options.preventDefaultOnTouchMove !== false) { | ||
var preventDefaultOnTouchMove = this.options.preventDefaultOnTouchMove; | ||
if (preventDefaultOnTouchMove) { | ||
container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
e.preventDefault(); | ||
} | ||
that.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, false); | ||
_this2.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, willPreventDefault); | ||
} else { | ||
container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
_this2.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, willNotPreventDefault); | ||
} | ||
this.container.addEventListener('touchend', this.onTouchEnd = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
container.addEventListener('touchend', this.onTouchEnd = function (e) { | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}, false); | ||
}, willNotPreventDefault); | ||
this.container.addEventListener('touchcancel', this.onTouchCancel = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
container.addEventListener('touchcancel', this.onTouchCancel = function (e) { | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}, false); | ||
}, willNotPreventDefault); | ||
this.onMouseUp = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
document.removeEventListener('mousemove', _this2.onMouseMove, false); | ||
@@ -268,3 +306,3 @@ document.removeEventListener('mouseup', _this2.onMouseUp, false); | ||
this.onMouseMove = function (e) { | ||
that.scroller.doTouchMove([{ | ||
_this2.scroller.doTouchMove([{ | ||
pageX: e.pageX, | ||
@@ -275,3 +313,3 @@ pageY: e.pageY | ||
this.container.addEventListener('mousedown', this.onMouseDown = function (e) { | ||
container.addEventListener('mousedown', this.onMouseDown = function (e) { | ||
if (lockMouse || e.target.tagName.match(/input|textarea|select/i) || _this2.disabled) { | ||
@@ -281,3 +319,3 @@ return; | ||
_this2.clearScrollbarTimer(); | ||
that.scroller.doTouchStart([{ | ||
_this2.scroller.doTouchStart([{ | ||
pageX: e.pageX, | ||
@@ -287,3 +325,3 @@ pageY: e.pageY | ||
// reflow since the container may have changed | ||
that.reflow(); | ||
_this2.reflow(); | ||
e.preventDefault(); | ||
@@ -294,5 +332,5 @@ document.addEventListener('mousemove', _this2.onMouseMove, false); | ||
this.container.addEventListener('mousewheel', this.onMouseWheel = function (e) { | ||
if (that.options.zooming) { | ||
that.scroller.doMouseZoom(e.wheelDelta, e.timeStamp, e.pageX, e.pageY); | ||
container.addEventListener('mousewheel', this.onMouseWheel = function (e) { | ||
if (_this2.options.zooming) { | ||
_this2.scroller.doMouseZoom(e.wheelDelta, e.timeStamp, e.pageX, e.pageY); | ||
e.preventDefault(); | ||
@@ -299,0 +337,0 @@ } |
# History | ||
---- | ||
## 0.4.0 / 2017-10-07 | ||
- use lightweight raf and passive event | ||
## 0.3.0 / 2017-05-23 | ||
@@ -5,0 +9,0 @@ |
@@ -6,23 +6,16 @@ 'use strict'; | ||
}); | ||
/* | ||
* Scroller | ||
* http://github.com/zynga/scroller | ||
* | ||
* Copyright 2011, Zynga Inc. | ||
* Licensed under the MIT License. | ||
* https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt | ||
* | ||
* Based on the work of: Unify Project (unify-project.org) | ||
* http://unify-project.org | ||
* Copyright 2011, Deutsche Telekom AG | ||
* License: MIT + Apache (V2) | ||
*/ | ||
var _raf = require('raf'); | ||
var _raf2 = _interopRequireDefault(_raf); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var desiredFrames = 60; /* | ||
* Scroller | ||
* http://github.com/zynga/scroller | ||
* | ||
* Copyright 2011, Zynga Inc. | ||
* Licensed under the MIT License. | ||
* https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt | ||
* | ||
* Based on the work of: Unify Project (unify-project.org) | ||
* http://unify-project.org | ||
* Copyright 2011, Deutsche Telekom AG | ||
* License: MIT + Apache (V2) | ||
*/ | ||
/** | ||
@@ -38,3 +31,3 @@ * Generic animation class with support for dropped frames both optional easing and duration. | ||
*/ | ||
var desiredFrames = 60; | ||
var millisecondsPerSecond = 1000; | ||
@@ -49,2 +42,33 @@ var running = {}; | ||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | ||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | ||
// requestAnimationFrame polyfill by Erik Möller | ||
// fixes from Paul Irish and Tino Zijdel | ||
(function () { | ||
var lastTime = 0; | ||
var vendors = ['ms', 'moz', 'webkit', 'o']; | ||
for (var x = 0; x < vendors.length && !win.requestAnimationFrame; ++x) { | ||
win.requestAnimationFrame = win[vendors[x] + 'RequestAnimationFrame']; | ||
win.cancelAnimationFrame = win[vendors[x] + 'CancelAnimationFrame'] || win[vendors[x] + 'CancelRequestAnimationFrame']; | ||
} | ||
if (!win.requestAnimationFrame) { | ||
win.requestAnimationFrame = function (callback) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = win.setTimeout(function () { | ||
callback(currTime + timeToCall); | ||
}, timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
} | ||
if (!win.cancelAnimationFrame) { | ||
win.cancelAnimationFrame = function (id) { | ||
clearTimeout(id); | ||
}; | ||
} | ||
})(); | ||
var Animate = { | ||
@@ -148,3 +172,3 @@ /** | ||
lastFrame = now; | ||
(0, _raf2['default'])(step); | ||
win.requestAnimationFrame(step); | ||
} | ||
@@ -157,3 +181,3 @@ }; | ||
// Init first step | ||
(0, _raf2['default'])(step); | ||
win.requestAnimationFrame(step); | ||
@@ -160,0 +184,0 @@ // Return unique animation ID |
@@ -31,2 +31,17 @@ 'use strict'; | ||
var supportsPassive = false; | ||
try { | ||
var opts = Object.defineProperty({}, 'passive', { | ||
get: function get() { | ||
supportsPassive = true; | ||
} | ||
}); | ||
window.addEventListener('test', null, opts); | ||
} catch (e) { | ||
// empty | ||
} | ||
var willPreventDefault = supportsPassive ? { passive: false } : false; | ||
var willNotPreventDefault = supportsPassive ? { passive: true } : false; | ||
function DOMScroller(content) { | ||
@@ -47,3 +62,3 @@ var _this = this; | ||
this.content = content; | ||
this.container = content.parentNode; | ||
var container = this.container = content.parentNode; | ||
this.options = (0, _extends3['default'])({}, options, { | ||
@@ -91,3 +106,3 @@ scrollingComplete: function scrollingComplete() { | ||
indicatorsPos[k] = 0; | ||
_this.container.appendChild(scrollbars[k]); | ||
container.appendChild(scrollbars[k]); | ||
} | ||
@@ -166,9 +181,12 @@ }); | ||
DOMScroller.prototype.setIndicatorPos = function setIndicatorPos(axis, value) { | ||
if (this.indicatorsPos[axis] !== value) { | ||
var indicatorsPos = this.indicatorsPos, | ||
indicators = this.indicators; | ||
if (indicatorsPos[axis] !== value) { | ||
if (axis === 'x') { | ||
setTransform(this.indicators[axis].style, 'translate3d(' + value + 'px,0,0)'); | ||
setTransform(indicators[axis].style, 'translate3d(' + value + 'px,0,0)'); | ||
} else { | ||
setTransform(this.indicators[axis].style, 'translate3d(0, ' + value + 'px,0)'); | ||
setTransform(indicators[axis].style, 'translate3d(0, ' + value + 'px,0)'); | ||
} | ||
this.indicatorsPos[axis] = value; | ||
indicatorsPos[axis] = value; | ||
} | ||
@@ -178,5 +196,8 @@ }; | ||
DOMScroller.prototype.setIndicatorSize = function setIndicatorSize(axis, value) { | ||
if (this.indicatorsSize[axis] !== value) { | ||
this.indicators[axis].style[axis === 'x' ? 'width' : 'height'] = value + 'px'; | ||
this.indicatorsSize[axis] = value; | ||
var indicatorsSize = this.indicatorsSize, | ||
indicators = this.indicators; | ||
if (indicatorsSize[axis] !== value) { | ||
indicators[axis].style[axis === 'x' ? 'width' : 'height'] = value + 'px'; | ||
indicatorsSize[axis] = value; | ||
} | ||
@@ -186,20 +207,27 @@ }; | ||
DOMScroller.prototype.reflow = function reflow() { | ||
if (this.scrollbars) { | ||
this.contentSize.x = this.content.offsetWidth; | ||
this.contentSize.y = this.content.offsetHeight; | ||
this.clientSize.x = this.container.clientWidth; | ||
this.clientSize.y = this.container.clientHeight; | ||
if (this.scrollbars.x) { | ||
this.scrollbarsSize.x = this.scrollbars.x.offsetWidth; | ||
var container = this.container, | ||
content = this.content, | ||
scrollbarsSize = this.scrollbarsSize, | ||
contentSize = this.contentSize, | ||
scrollbars = this.scrollbars, | ||
clientSize = this.clientSize; | ||
if (scrollbars) { | ||
contentSize.x = content.offsetWidth; | ||
contentSize.y = content.offsetHeight; | ||
clientSize.x = container.clientWidth; | ||
clientSize.y = container.clientHeight; | ||
if (scrollbars.x) { | ||
scrollbarsSize.x = scrollbars.x.offsetWidth; | ||
} | ||
if (this.scrollbars.y) { | ||
this.scrollbarsSize.y = this.scrollbars.y.offsetHeight; | ||
if (scrollbars.y) { | ||
scrollbarsSize.y = scrollbars.y.offsetHeight; | ||
} | ||
} | ||
// set the right scroller dimensions | ||
this.scroller.setDimensions(this.container.clientWidth, this.container.clientHeight, this.content.offsetWidth, this.content.offsetHeight); | ||
this.scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight); | ||
// refresh the position for zooming purposes | ||
var rect = this.container.getBoundingClientRect(); | ||
this.scroller.setPosition(rect.x + this.container.clientLeft, rect.y + this.container.clientTop); | ||
var rect = container.getBoundingClientRect(); | ||
this.scroller.setPosition(rect.x + container.clientLeft, rect.y + container.clientTop); | ||
}; | ||
@@ -209,11 +237,13 @@ | ||
this._destroyed = true; | ||
var container = this.container; | ||
window.removeEventListener('resize', this.onResize, false); | ||
this.container.removeEventListener('touchstart', this.onTouchStart, false); | ||
this.container.removeEventListener('touchmove', this.onTouchMove, false); | ||
this.container.removeEventListener('touchend', this.onTouchEnd, false); | ||
this.container.removeEventListener('touchcancel', this.onTouchCancel, false); | ||
this.container.removeEventListener('mousedown', this.onMouseDown, false); | ||
container.removeEventListener('touchstart', this.onTouchStart, false); | ||
container.removeEventListener('touchmove', this.onTouchMove, false); | ||
container.removeEventListener('touchend', this.onTouchEnd, false); | ||
container.removeEventListener('touchcancel', this.onTouchCancel, false); | ||
container.removeEventListener('mousedown', this.onMouseDown, false); | ||
document.removeEventListener('mousemove', this.onMouseMove, false); | ||
document.removeEventListener('mouseup', this.onMouseUp, false); | ||
this.container.removeEventListener('mousewheel', this.onMouseWheel, false); | ||
container.removeEventListener('mousewheel', this.onMouseWheel, false); | ||
}; | ||
@@ -224,7 +254,5 @@ | ||
var that = this; | ||
// reflow handling | ||
window.addEventListener('resize', this.onResize = function () { | ||
that.reflow(); | ||
_this2.reflow(); | ||
}, false); | ||
@@ -235,3 +263,6 @@ | ||
this.container.addEventListener('touchstart', this.onTouchStart = function (e) { | ||
var container = this.container; | ||
container.addEventListener('touchstart', this.onTouchStart = function (e) { | ||
lockMouse = true; | ||
@@ -248,29 +279,36 @@ if (releaseLockTimer) { | ||
// reflow since the container may have changed | ||
that.reflow(); | ||
that.scroller.doTouchStart(e.touches, e.timeStamp); | ||
}, false); | ||
_this2.reflow(); | ||
_this2.scroller.doTouchStart(e.touches, e.timeStamp); | ||
}, willNotPreventDefault); | ||
this.container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
if (_this2.options.preventDefaultOnTouchMove !== false) { | ||
var preventDefaultOnTouchMove = this.options.preventDefaultOnTouchMove; | ||
if (preventDefaultOnTouchMove) { | ||
container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
e.preventDefault(); | ||
} | ||
that.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, false); | ||
_this2.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, willPreventDefault); | ||
} else { | ||
container.addEventListener('touchmove', this.onTouchMove = function (e) { | ||
_this2.scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
}, willNotPreventDefault); | ||
} | ||
this.container.addEventListener('touchend', this.onTouchEnd = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
container.addEventListener('touchend', this.onTouchEnd = function (e) { | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}, false); | ||
}, willNotPreventDefault); | ||
this.container.addEventListener('touchcancel', this.onTouchCancel = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
container.addEventListener('touchcancel', this.onTouchCancel = function (e) { | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}, false); | ||
}, willNotPreventDefault); | ||
this.onMouseUp = function (e) { | ||
that.scroller.doTouchEnd(e.timeStamp); | ||
_this2.scroller.doTouchEnd(e.timeStamp); | ||
document.removeEventListener('mousemove', _this2.onMouseMove, false); | ||
@@ -281,3 +319,3 @@ document.removeEventListener('mouseup', _this2.onMouseUp, false); | ||
this.onMouseMove = function (e) { | ||
that.scroller.doTouchMove([{ | ||
_this2.scroller.doTouchMove([{ | ||
pageX: e.pageX, | ||
@@ -288,3 +326,3 @@ pageY: e.pageY | ||
this.container.addEventListener('mousedown', this.onMouseDown = function (e) { | ||
container.addEventListener('mousedown', this.onMouseDown = function (e) { | ||
if (lockMouse || e.target.tagName.match(/input|textarea|select/i) || _this2.disabled) { | ||
@@ -294,3 +332,3 @@ return; | ||
_this2.clearScrollbarTimer(); | ||
that.scroller.doTouchStart([{ | ||
_this2.scroller.doTouchStart([{ | ||
pageX: e.pageX, | ||
@@ -300,3 +338,3 @@ pageY: e.pageY | ||
// reflow since the container may have changed | ||
that.reflow(); | ||
_this2.reflow(); | ||
e.preventDefault(); | ||
@@ -307,5 +345,5 @@ document.addEventListener('mousemove', _this2.onMouseMove, false); | ||
this.container.addEventListener('mousewheel', this.onMouseWheel = function (e) { | ||
if (that.options.zooming) { | ||
that.scroller.doMouseZoom(e.wheelDelta, e.timeStamp, e.pageX, e.pageY); | ||
container.addEventListener('mousewheel', this.onMouseWheel = function (e) { | ||
if (_this2.options.zooming) { | ||
_this2.scroller.doMouseZoom(e.wheelDelta, e.timeStamp, e.pageX, e.pageY); | ||
e.preventDefault(); | ||
@@ -312,0 +350,0 @@ } |
{ | ||
"name": "zscroller", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "dom scroller based on zynga scroller", | ||
@@ -47,5 +47,4 @@ "keywords": [ | ||
"dependencies": { | ||
"babel-runtime": "6.x", | ||
"raf": "^3.3.0" | ||
"babel-runtime": "6.x" | ||
} | ||
} |
120260
1
2933
- Removedraf@^3.3.0
- Removedperformance-now@2.1.0(transitive)
- Removedraf@3.4.1(transitive)