mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Missed off 7c9976f1d9
This commit is contained in:
parent
7c9976f1d9
commit
b7465c5eb1
@ -73,11 +73,18 @@ PageScroller.prototype.scrollIntoView = function(element) {
|
||||
// returns: new position of the scroll viewport
|
||||
var getEndPos = function(targetPos,targetSize,currentPos,currentSize) {
|
||||
var newPos = currentPos;
|
||||
// If the target is above/left of the current view, then scroll to it's top/left
|
||||
if(targetPos <= currentPos) {
|
||||
newPos = targetPos;
|
||||
// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window
|
||||
} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {
|
||||
newPos = targetPos + targetSize - currentSize;
|
||||
// If the target is big, then just scroll to the top
|
||||
} else if(currentPos < targetPos) {
|
||||
newPos = targetPos;
|
||||
// Otherwise, stay where we are
|
||||
} else {
|
||||
newPos = currentPos;
|
||||
}
|
||||
// If we are scrolling within 50 pixels of the top/left then snap to zero
|
||||
if(newPos < 50) {
|
||||
|
Loading…
Reference in New Issue
Block a user