scrollability
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "scrollability", | ||
"description": "Native-like scrolling for the web", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "http://github.com/joehewitt/scrollability", | ||
"repository": { | ||
"type": "git", | ||
"url" : "http://github.com/joehewitt/scrollability.git" | ||
"type": "git", | ||
"url": "git://github.com/joehewitt/scrollability.git" | ||
}, | ||
"keywords": ["scrolling"], | ||
"keywords": [ | ||
"client" | ||
], | ||
"author": "Joe Hewitt <joe@joehewitt.com>", | ||
"contributors": [], | ||
"dependencies": {}, | ||
"engines": { "node": ">=0.4.0" }, | ||
"engines": { | ||
"node": ">=0.4.0" | ||
}, | ||
"main": "./scrollability", | ||
"directories": {}, | ||
"app.js": { | ||
"static": "./static" | ||
} | ||
} | ||
"static": "./static" | ||
}, | ||
"devDependencies": {} | ||
} |
@@ -208,3 +208,4 @@ /* See LICENSE for terms of usage */ | ||
setSpacing: setSpacing, | ||
setOffset: setOffset | ||
setOffset: setOffset, | ||
setBounds: setBounds | ||
}; | ||
@@ -266,2 +267,7 @@ if (!dispatch("scrollability-start", node, event)) { | ||
function setBounds(newMin, newMax) { | ||
min = newMin; | ||
max = newMax; | ||
} | ||
function track(touch, time) { | ||
@@ -306,6 +312,6 @@ timeStep = time - lastTime; | ||
function trackScrollbar(position) { | ||
var range = -min - max; | ||
if (scrollbar && viewport < range) { | ||
var range = max - min; | ||
if (scrollbar && min < 0) { | ||
var viewable = viewport - kScrollbarMargin*2; | ||
var height = (viewable/range) * viewable; | ||
var height = (viewable/(range+viewport)) * viewable; | ||
var scrollPosition; | ||
@@ -320,3 +326,3 @@ if (position > max) { | ||
} else { | ||
scrollPosition = (Math.abs(position) / range) * (viewable-height); | ||
scrollPosition = (Math.abs((max-position)) / range) * (viewable-height); | ||
} | ||
@@ -331,2 +337,9 @@ scrollPosition += kScrollbarMargin; | ||
function takeoff() { | ||
dispatch("scrollability-takeoff", node, { | ||
position: position, | ||
min: min, | ||
max: max, | ||
setBounds: setBounds | ||
}); | ||
if (stopped) { | ||
@@ -333,0 +346,0 @@ velocity = 0; |
652480
666