Skip to content

Commit

Permalink
Fix scrolling on firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
widmoser committed May 19, 2016
1 parent 4d05c37 commit b8ebaba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 8 additions & 5 deletions dist/tileview.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
var itemSize = scope.options.tileSize[sizeDimension];
var maxScrollPosition = rowCount * itemSize - rect[sizeDimension];
var scrollDimension = scope.options.alignHorizontal ? 'scrollLeft' : 'scrollTop';
container[0][scrollDimension] = clamp(container[0][scrollDimension], 0, maxScrollPosition);
var scrollPosition = container[0][scrollDimension];
var scrollEndThreshold = maxScrollPosition - scope.options.scrollEndOffset * itemSize;
if (scrollPosition >= scrollEndThreshold && !(lastScrollPosition >= scrollEndThreshold) && scope.options.onScrollEnd !== undefined) {
Expand All @@ -170,10 +169,14 @@
}
}
function setPlaceholder() {
heightStart = Math.max(startRow * scope.options.tileSize[sizeDimension], 0);
heightEnd = Math.max((rowCount - endRow) * scope.options.tileSize[sizeDimension], 0);
placeholderStart.css(sizeDimension, heightStart + 'px');
placeholderEnd.css(sizeDimension, heightEnd + 'px');
var newHeightStart = Math.max(startRow * scope.options.tileSize[sizeDimension], 0);
var newHeightEnd = Math.max((rowCount - endRow) * scope.options.tileSize[sizeDimension], 0);
if (newHeightStart !== heightStart || newHeightEnd !== heightEnd) {
placeholderStart.css(sizeDimension, newHeightStart + 'px');
placeholderEnd.css(sizeDimension, newHeightEnd + 'px');
heightStart = newHeightStart;
heightEnd = newHeightEnd;
}
}
function createElements(diff) {
updateVisibleRows();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tileview",
"version": "0.5.2",
"version": "0.5.7",
"description": "A tileview for angular",
"main": "gulpfile.js",
"scripts": {
Expand Down
13 changes: 8 additions & 5 deletions src/tileview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ declare const angular: any;
const maxScrollPosition = rowCount*itemSize - rect[sizeDimension];

const scrollDimension = scope.options.alignHorizontal ? 'scrollLeft' : 'scrollTop';
container[0][scrollDimension] = clamp(container[0][scrollDimension], 0, maxScrollPosition);
const scrollPosition = container[0][scrollDimension];

const scrollEndThreshold = maxScrollPosition - scope.options.scrollEndOffset*itemSize;
Expand Down Expand Up @@ -192,10 +191,14 @@ declare const angular: any;
}

function setPlaceholder() {
heightStart = Math.max(startRow * scope.options.tileSize[sizeDimension], 0);
heightEnd = Math.max((rowCount - endRow) * scope.options.tileSize[sizeDimension], 0);
placeholderStart.css(sizeDimension, heightStart + 'px');
placeholderEnd.css(sizeDimension, heightEnd + 'px');
const newHeightStart = Math.max(startRow * scope.options.tileSize[sizeDimension], 0);
const newHeightEnd = Math.max((rowCount - endRow) * scope.options.tileSize[sizeDimension], 0);
if (newHeightStart !== heightStart || newHeightEnd !== heightEnd) {
placeholderStart.css(sizeDimension, newHeightStart + 'px');
placeholderEnd.css(sizeDimension, newHeightEnd + 'px');
heightStart = newHeightStart;
heightEnd = newHeightEnd;
}
}

function createElements(diff) {
Expand Down

0 comments on commit b8ebaba

Please sign in to comment.