Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@ Remove all items:
tree.clear();
```

**warning**

The remove implementation relies on the coordinates of the object to be the same as when it was inserted.
This is because the fn is optimised to only look for the object to remove in the sections of the tree it expects them to be in, based on the coordinates of the item being removed.

This will cause issues

```js

// bad
obj.minX += 5
obj.maxX -= 5
tree.remove(obj)
tree.insert(obj)

// you may end up with two copies of the object

// good
tree.remove(obj)
obj.minX += 5
obj.maxX -= 5
tree.insert(obj)
```

### Data Format

By default, RBush assumes the format of data points to be an object
Expand Down