Skip to content

Commit

Permalink
Tiny optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
NeXTs committed Aug 1, 2015
1 parent af98e9e commit e12e4ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
8 changes: 3 additions & 5 deletions clusterize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Clusterize.js - v0.9.0 - 2015-07-30
/*! Clusterize.js - v0.9.1 - 2015-08-01
* http://NeXTs.github.com/Clusterize.js/
* Copyright (c) 2015 Denis Lukov; Licensed MIT */

Expand Down Expand Up @@ -177,8 +177,7 @@
},
// get current cluster number
getClusterNum: function () {
var opts = this.options;
return Math.floor(this.scroll_elem.scrollTop / (opts.cluster_height - opts.block_height));
return Math.floor(this.scroll_elem.scrollTop / (this.options.cluster_height - this.options.block_height));
},
// generate empty row if no data provided
generateEmptyRow: function() {
Expand Down Expand Up @@ -207,8 +206,7 @@
if( ! opts.cluster_height) {
this.exploreEnvironment(rows);
}
var items_start = (opts.rows_in_cluster - opts.rows_in_block) * cluster_num,
items_start = items_start > 0 ? items_start : 0,
var items_start = Math.max((opts.rows_in_cluster - opts.rows_in_block) * cluster_num, 0),
items_end = items_start + opts.rows_in_cluster,
top_space = items_start * opts.item_height,
bottom_space = (rows_len - items_end) * opts.item_height,
Expand Down
18 changes: 9 additions & 9 deletions clusterize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clusterize.js",
"version": "0.9.0",
"version": "0.9.1",
"description": "Tiny vanilla JS plugin to display large data sets easily",
"main": "clusterize.js",
"style": "clusterize.css",
Expand Down

0 comments on commit e12e4ce

Please sign in to comment.