caleb531/jcanvas — pull request #107 by CWSpear (2013-06-23 07:18:01+00:00)
Title: detectPixelRatio tweaks.

Always apply detectPixelRatio changed (if called) and use jQuery outerWidth/Height to get original height/width.

I only did a couple tests, but I was trying to draw on a Retina display, and I found that `detectPixelRatio` worked... but it shrunk my canvas. I changed it to use the `$canvas`'s `.outerWidth()` and `.outerHeight()` (via jQuery) to find the `oldWidth` and `oldHeight` and it worked perfectly (see line 3018).

Then I tested on a non-Retina computer, and the ratio was one (so that method doesn't actually make any changes), but it was all askew... I then remove the `if (ratio !== 1)` if statement and it worked flawlessly.

So I don't quite know what's going here or if this will "always" work...

I'm using [jCanvas](http://calebevans.me/projects/jcanvas/) to draw, but in my testing, it was drawing the same as the vanilla style (so I don't think it's why things are weird).

Just for completeness' sake, this is what I'm using to draw:

```javascript
$this.bind('touchmove mousemove', function(event) {
if(!isDrawing) return;

var thisX = event.offsetX;
var thisY = event.offsetY;

$this.drawLine({
strokeStyle: '#000',
strokeWidth: 1,
rounded: true,
x1: lastX, y1: lastY,
x2: thisX, y2: thisY
});

lastX = thisX;
lastY = thisY;
});
```