fixed pixel ratio issue with buffer canvas usage

This commit is contained in:
Eric Rowell
2013-11-02 22:31:09 -07:00
parent 4ed8ac8088
commit f5d5e26e5e
6 changed files with 71 additions and 2 deletions

View File

@@ -14,6 +14,30 @@ suite('Stage', function() {
});
});
// ======================================================
test('test stage buffer canvas and hit buffer canvas', function() {
var container = document.createElement('div');
container.id = 'container';
kineticContainer.appendChild(container);
// simulate pixelRatio = 2
Kinetic.pixelRatio = 2;
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 200
});
assert.equal(stage.bufferCanvas.getPixelRatio(), 1);
assert.equal(stage.bufferHitCanvas.getPixelRatio(), 2);
// reset
Kinetic.pixelRatio = 1;
});
// ======================================================
test('instantiate stage with dom element', function() {
var container = document.createElement('div');