SimFla/SimFla-signaturePad — pull request #1 by bbudd (2012-07-24 17:49:00+00:00)
Title: some upgrades

Hey man -

I really like this plugin. It works super well. I made a few upgrades to it, though.

1 - Checks for canvas to begin with (I'm using this on a desktop browser app, need to just give people buttons if they're in older IEs). Went with modernizr's method -- Paul Irish gives a good explanation for why they do it the way they do, I'm hard-pressed to find a compelling counter-argument.

2 - Made it so the pad can be in a part of the page that's scrolled to (just subtracting Ext.getBody().getScroll().top from the yPos)

3 - Allowed for user configs
- styles: canvas color, border styles, etc - puts them directly onto the canvas element
- color: sets the line color, defaults to your black. We like a blue pen color.
- activeCursor: set the drawing cursor (if implemented) instead of the default, which is generally 'select'
- app: set the containing app inside the plugin
- appDisablesButtons: allow for enabling and disabling of buttons - so a user can't submit a blank canvas (this is where we use the app config)

4 - Moved the two listener enables into their own functions, plus added a generic 'enable' function to call both of them (we don't use it, but someone might), plus added a 'disable' function in case someone wanted to stop the pad from being used (we do use this one). The functions start and stop line drawing. I could have done it with a simple boolean, but opted for turning on and off listeners.