DmitryBaranovskiy/raphael — pull request #429 by rzurad (2011-10-23 21:49:12+00:00)
Title: Adding tooltips and brightness functions from g.Raphael as plugins

This pull request adds two plugins into the `plugin/` directory that are ports of functions originally in g.Raphael (see my pull request on the g.raphael repository for more information). Note that if you do not want these plugins to be in the main raphael repository, then they can be easily moved back to the g.raphael repository.

## plugin.tooltips

This plugin consists of the `popup`, `label`, `flag`, `tag`, `blob`, and `drop` functions from g.Raphael, modified and placed on the Element prototype with alias functions on the Set prototype, meaning any Element or Set can be used as content for any tooltip (`popupit` and `labelit` were removed, as now this exact functionality is available to all tooltips by calling them on Element/Set objects). Alias functions for each tooltip have also been placed on the Paper prototype to make them callable from a paper object in a similar manner as before:

```
//call it like before, but without the namespace
r.popup(350, 150, "$9.99", 'right');

//or call it on an element/set object
//Note: any missing arguments default to the caller's current values
r.circle(650, 150, 10).attr({fill:'#ff0000'}).popup();
r.circle(800, 400, 10).attr({fill:'#ff0000'}).popup(700, 150, 'down');
```

Note: if you are calling these tooltips on Set objects, it is assumed that all elements in the given Set share the same paper instance.

Because the `g` namespace has been removed, it is important to note that all configuration attributes that were on the `g` object have been removed (`txtattr`, `shim`, etc). This means that if you want to change the attributes of a text object you're using as tooltip content, you will have to call it on the text instance and change the text via attributes: `r.text().attr({ /* your txtattr */}).popup()`

All tooltip functions have the same configuration options with the following exceptions:

- all `dir` options have been changed from `0, 1, 2, 3`, to `'down', 'left', 'up', 'right'` repectively.
- `blob` and `drop` no longer accept size parameters. Instead, the bounding box of the Element/Set being used as content is used to automatically determine the size.

Tests for this plugin are available in the `test/` directory and can be temporarily viewed here:
http://www.srsfknbzns.com/raphael/test/plugins.tooltips.html

## plugin.brightness

This plugin is just the `lighter`, `darker` and `original` functions from g.Raphael with the following changes:

- `original` has been changed to `resetBrightness`
- all functions are chainable

Tests for this plugin are available in the `test/` directory and can be temporarily viewed here:
http://www.srsfknbzns.com/raphael/test/plugins.brightness.html