mirror of
https://github.com/konvajs/konva.git
synced 2025-06-27 17:09:44 +08:00
added another functional test to cover more transform and drag and drop cases
This commit is contained in:
parent
1f41e931b9
commit
eaab71e242
@ -946,9 +946,8 @@ Test.prototype.tests = {
|
||||
|
||||
layer.on('click', function(evt) {
|
||||
log(evt.shape.getName());
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
var redCircle = new Kinetic.Circle({
|
||||
x: stage.width / 2,
|
||||
y: stage.height / 2,
|
||||
@ -1029,9 +1028,9 @@ Test.prototype.tests = {
|
||||
|
||||
layer.add(rect);
|
||||
stage.add(layer);
|
||||
|
||||
|
||||
//stage.rotateDeg(20);
|
||||
|
||||
|
||||
//console.log(rect.getAbsoluteTransform().getTranslation())
|
||||
|
||||
stage.rotate(Math.PI / 3);
|
||||
@ -1378,6 +1377,35 @@ Test.prototype.tests = {
|
||||
layer.add(group);
|
||||
stage.add(layer);
|
||||
},
|
||||
'DRAG AND DROP - translate, rotate, and scale shape, and then drag and drop': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
var group = new Kinetic.Group();
|
||||
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 200,
|
||||
y: 100,
|
||||
width: 100,
|
||||
height: 50,
|
||||
fill: 'red',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
draggable: true,
|
||||
rotationDeg: 60,
|
||||
scale: {
|
||||
x: 2,
|
||||
y: 1
|
||||
}
|
||||
});
|
||||
|
||||
group.add(rect);
|
||||
layer.add(group);
|
||||
stage.add(layer);
|
||||
},
|
||||
'STAGE - save image as png (click on circle to open new window)': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
Loading…
Reference in New Issue
Block a user