Skip to content

Commit

Permalink
fix: handle scrolling offset by resetting zone's box
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet committed Nov 29, 2015
1 parent a0b1d7e commit 6ccd0b5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ function Collection (manager, options) {
self.options.maxNumberOfNipples = 1;
}

self.box = self.options.zone.getBoundingClientRect();

self.updateBox();
self.prepareNipples();
self.bindings();
self.begin();
Expand Down Expand Up @@ -173,6 +172,11 @@ Collection.prototype.createNipple = function (position, identifier) {
return nipple;
};

Collection.prototype.updateBox = function () {
var self = this;
self.box = self.options.zone.getBoundingClientRect();
};

Collection.prototype.bindNipple = function (nipple) {
var self = this;
var type;
Expand Down Expand Up @@ -214,6 +218,9 @@ Collection.prototype.onstart = function (evt) {
var opts = self.options;
evt = u.prepareEvent(evt);

// Update the box position
self.updateBox();

var process = function (touch) {
// If we can create new nipples
// meaning we don't have more active nipples than we should.
Expand Down

0 comments on commit 6ccd0b5

Please sign in to comment.