Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4364 from ptarjan/patch-1
Browse files Browse the repository at this point in the history
don't throw exceptions if the view is destroyed before the view is resized
mlynch committed Dec 6, 2015
2 parents e899ad5 + ca3d897 commit 5e26d4b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions js/angular/controller/scrollController.js
Original file line number Diff line number Diff line change
@@ -108,43 +108,64 @@ function($scope,

self.scrollTop = function(shouldAnimate) {
self.resize().then(function() {
if (!scrollView) {
return;
}
scrollView.scrollTo(0, 0, !!shouldAnimate);
});
};

self.scrollBottom = function(shouldAnimate) {
self.resize().then(function() {
if (!scrollView) {
return;
}
var max = scrollView.getScrollMax();
scrollView.scrollTo(max.left, max.top, !!shouldAnimate);
});
};

self.scrollTo = function(left, top, shouldAnimate) {
self.resize().then(function() {
if (!scrollView) {
return;
}
scrollView.scrollTo(left, top, !!shouldAnimate);
});
};

self.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {
self.resize().then(function() {
if (!scrollView) {
return;
}
scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);
});
};

self.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {
self.resize().then(function() {
if (!scrollView) {
return;
}
scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);
});
};

self.scrollBy = function(left, top, shouldAnimate) {
self.resize().then(function() {
if (!scrollView) {
return;
}
scrollView.scrollBy(left, top, !!shouldAnimate);
});
};

self.anchorScroll = function(shouldAnimate) {
self.resize().then(function() {
if (!scrollView) {
return;
}
var hash = $location.hash();
var elm = hash && $document[0].getElementById(hash);
if (!(hash && elm)) {

0 comments on commit 5e26d4b

Please sign in to comment.