Skip to content

Commit 193c0b5

Browse files
committed
Simplify for loop with _.each
1 parent eebba75 commit 193c0b5

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

public/javascripts/DV/lib/page_set.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// PageSet is a pseudo-presenter/view which manages and paints
2+
// pages into a viewer's main display.
3+
//
4+
// PageSet creates three page objects, two of which are on screen
5+
// at any one time. The third is then updated off screen when
6+
// the display is scrolled.
7+
//
8+
// PageSet is also manages zooming.
19
DV.PageSet = function(viewer){
210
this.currentPage = null;
311
this.pages = {};
@@ -16,18 +24,16 @@ DV.PageSet.prototype.execute = function(action,params){
1624
DV.PageSet.prototype.buildPages = function(options) {
1725
options = options || {};
1826
var pages = this.getPages();
19-
for(var i = 0; i < pages.length; i++) {
20-
var page = pages[i];
27+
28+
_.each(pages, function(page){
2129
page.set = this;
22-
page.index = i;
2330

2431
// TODO: Make more explicit, this is sloppy
2532
this.pages[page.label] = new DV.Page(this.viewer, page);
2633

27-
if(page.currentPage == true) {
28-
this.currentPage = this.pages[page.label];
29-
}
30-
}
34+
if (page.currentPage == true) { this.currentPage = this.pages[page.label]; }
35+
}, this);
36+
3137
this.viewer.models.annotations.renderAnnotations();
3238
};
3339

0 commit comments

Comments
 (0)