clipping regions now work correctly when device pixel ratio != 1

This commit is contained in:
Eric Rowell
2013-08-25 22:26:42 -07:00
parent bf39df54b0
commit 6663ec0652
5 changed files with 55 additions and 16 deletions

View File

@@ -0,0 +1,32 @@
Test.Modules.CANVAS = {
'pixel ratio': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: 578/2,
y: 100,
radius: 70,
fill: 'green',
stroke: 'blue',
strokeWidth: 4
});
layer.add(circle);
stage.add(layer);
stage.setWidth(578/2);
stage.setHeight(100);
stage.draw();
}
};

View File

@@ -1,5 +1,5 @@
Test.Modules.CONTAINER = {
'use clipping function': function(containerId) {
'clip': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
@@ -7,10 +7,7 @@ Test.Modules.CONTAINER = {
draggable: true
});
var layer = new Kinetic.Layer({
clipFunc: function(canvas) {
var context = canvas.getContext();
context.rect(0, 0, 400, 100);
}
clip: [0, 0, stage.getWidth() / 2, 100]
});
var group = new Kinetic.Group();
var circle = new Kinetic.Circle({