mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-13 14:38:49 -04:00
Switch HiDPI on by default.
Allow deactivation by setting the hidpi attribute to "off" on the canvas.
This commit is contained in:
parent
5439f6ba45
commit
1f98d72c5b
103 changed files with 121 additions and 122 deletions
src/ui
|
@ -42,15 +42,15 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
|
|||
+ canvas);
|
||||
canvas = CanvasProvider.getCanvas(size);
|
||||
}
|
||||
var ctx = this._context = canvas.getContext('2d');
|
||||
this._context = canvas.getContext('2d');
|
||||
// Have Item count installed mouse events.
|
||||
this._eventCounters = {};
|
||||
this._ratio = 1;
|
||||
if (PaperScope.hasAttribute(canvas, 'hidpi')) {
|
||||
if (PaperScope.getAttribute(canvas, 'hidpi') !== 'off') {
|
||||
// Hi-DPI Canvas support based on:
|
||||
// http://www.html5rocks.com/en/tutorials/canvas/hidpi/
|
||||
var deviceRatio = window.devicePixelRatio || 1,
|
||||
backingStoreRatio = DomElement.getPrefixValue(ctx,
|
||||
backingStoreRatio = DomElement.getPrefixValue(this._context,
|
||||
'backingStorePixelRatio') || 1;
|
||||
this._ratio = deviceRatio / backingStoreRatio;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue