koggdal/ocanvas — pull request #43 by seanfox (2012-06-19 00:42:17+00:00)
Title: Bug fix for mouse events on line objects and another small bug fix for event handlers

There was a bug in tools.js inside the isPointerInside() method for the 'line' object. The code looked like this:

```js
var dX = Math.abs(obj.end.x - obj.abs_x),
dY = Math.abs(obj.end.y - obj.abs_y),
```

The problem was that obj.end.x and obj.end.y are relative to the parent, where obj.abs_x and obj.abs_y are absolute (relative to the canvas).

---

A separate bug was in events.js in the triggerHandlers() method. The code looked like this:

```js
for (n = 0; n < numHandlers; n++) {
handlers[n].call(obj, e);
}
```

If any of the handlers happened to destroy the object (obj) or remove any of its event handlers, the remaining event handlers would no longer exist and it would blow up since handlers[n] would result in undefined.

---

Take a look at the changes and let me know if they're ok. :)

Sean