added Matrix.js and started integration

This commit is contained in:
Eric Rowell
2012-03-22 13:47:37 -07:00
parent afad713df3
commit 0da8adfb6e
9 changed files with 291 additions and 200 deletions

View File

@@ -1163,4 +1163,28 @@ Test.prototype.tests = {
layer.add(circle);
stage.add(layer);
},
'DRAG AND DROP - drag and drop shape inside scaled group': function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var group = new Kinetic.Group({
scale: {
x: 1.5,
y: 1.5
}
});
var circle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4,
draggable: true
});
group.add(circle);
layer.add(group);
stage.add(layer);
},
};

View File

@@ -830,6 +830,39 @@ Test.prototype.tests = {
test(circle.getDragConstraint() === 'vertical', 'drag constraint should be vertical');
test(circle.getDragBounds().bottom === 200, 'drag bottom should be 200');
},
'NODE - translate, rotate, scale shape': function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var circle = new Kinetic.Rect({
x: 100,
y: 100,
rotationDeg: 20,
width: 100,
height: 50,
fill: 'green',
stroke: 'black',
strokeWidth: 4,
scale: {
x: 2,
y: 1
},
centerOffset: {
x: 50,
y: 25
}
});
layer.add(circle);
stage.add(layer);
stage.onFrame(function(frame) {
circle.rotation += .1;
layer.draw();
});
//stage.start();
},
'STAGE - add layer then shape': function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();