Branch/resize bug

@stevencarr , @eric79 Can you two take a quick look at this pull request, to close #2800.

Setting the viewport based on the total dimensions of the webgl render canvas, as opposed to setting it to the dimensions of the actually used (ie, not including the 10 pixel border) canvas was causing bugs with mouse events producing incorrect values after resize.

Fix was to set the viewport based on the height and width with the borders removed. (also, some minor code standard fixes to the function that was touched).