scroll-into-view
Advanced tools
Comparing version 1.4.0 to 1.5.0
{ | ||
"name": "scroll-into-view", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "scrollIntoView.js", |
@@ -7,3 +7,2 @@ var raf = require('raf'); | ||
}else{ | ||
element.scrollLeft = x; | ||
@@ -62,8 +61,9 @@ element.scrollTop = y; | ||
time = Date.now() - scrollSettings.startTime, | ||
timeValue = 1 / scrollSettings.time * time; | ||
timeValue = Math.min(1 / scrollSettings.time * time, 1); | ||
if( | ||
time > scrollSettings.time || | ||
time > scrollSettings.time + 20 || | ||
(Math.abs(location.differenceY) <= 1 && Math.abs(location.differenceX) <= 1) | ||
){ | ||
setElementScroll(parent, location.x, location.y); | ||
parent._scrollSettings = null; | ||
@@ -73,10 +73,8 @@ return scrollSettings.end(); | ||
// Attempt to flatten out the value a little.. | ||
// ToDo: Flatten properly. | ||
var valueX = scrollSettings.ease(Math.abs(Math.pow(timeValue,2) - timeValue)), | ||
valueY = scrollSettings.ease(Math.abs(Math.pow(timeValue,2) - timeValue)); | ||
var valueX = timeValue, | ||
valueY = timeValue; | ||
setElementScroll(parent, | ||
location.x - (location.differenceX - location.differenceX * valueX), | ||
location.y - (location.differenceY - location.differenceY * valueY) | ||
location.x - location.differenceX * Math.pow(1 - valueX, valueX / 2), | ||
location.y - location.differenceY * Math.pow(1 - valueY, valueY / 2) | ||
); | ||
@@ -83,0 +81,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14949
301