kangax/fabric.js — pull request #1127 by GordoRank (2014-01-24 09:51:47+00:00)
Title: Optimize searchPossibleTargets for I-text

```searchPossibleTargets``` loops through all objects to find the target object.

When dealing with lots of objects this can very slow when called intensively.

This patch simply checks for the existence of an ```_activeObject``` and performs the check on that first, short circuiting the function if possible.

If ```_activeObject``` is not found or it has been determined that it is not the target, the function continues and loops through all objects as before.

For example, with 500 objects on the canvas (using my turbo mode) IText mouse selection drops to sub 5fps due to constantly looping through all objects and checking for the current target. With this patch selection performance returns to 60fps and is as fast as if there was only one object on the canvas.

Although this problem is mostly noticeable when dealing with a huge number of objects, it is a good optimization anyway. Thus this pull request.