Comparing version 2.2.0 to 2.3.0
14
index.js
@@ -169,2 +169,16 @@ var isGL = require('is-webgl-context'); | ||
Object.defineProperty(CanvasApp.prototype, 'deviceWidth', { | ||
get: function() { | ||
return this.width * this._DPR; | ||
} | ||
}); | ||
Object.defineProperty(CanvasApp.prototype, 'deviceHeight', { | ||
get: function() { | ||
return this.height * this._DPR; | ||
} | ||
}); | ||
CanvasApp.prototype.resetFPS = function() { | ||
@@ -171,0 +185,0 @@ this._frames = 0; |
{ | ||
"name": "canvas-app", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "sets up a retina-scaled canvas with render loop", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -91,9 +91,12 @@ # canvas-app | ||
- `running` whether the loop is currently running | ||
- `deviceWidth`, `deviceHeight` the actual device height (i.e. size * devicePixelRatio). This is needed for glViewport, glScissor, etc. | ||
### context scaling / viewport | ||
Before rendering, the 2d context is scaled to the device size (or the scale remains unchanged if `retina` was false). If the context is `"webgl"`, then instead `gl.viewport` will be called with the device size. | ||
For 2D contexts, `scale()` is called before rendering based on the deviePixelRatio. For WebGL contexts, `gl.viewport()` is called before rendering with the device size. | ||
If `retina` is false, the device size will be assumed to be the same as the canvas size. | ||
## License | ||
MIT, see [LICENSE.md](http://github.com/mattdesl/canvas-app/blob/master/LICENSE.md) for details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13459
206
101