R-tree implementation in Javascript