mirror of
https://github.com/konvajs/konva.git
synced 2025-12-26 14:45:44 +08:00
reworked transformation matrix operations with drag and drop
This commit is contained in:
@@ -1031,7 +1031,7 @@ Test.prototype.tests = {
|
||||
layer.add(circle);
|
||||
layer.draw();
|
||||
},
|
||||
'SHAPES - move shape, group, and layer, and then get absolute position': function(containerId) {
|
||||
'TRANSFORMS - move shape, group, and layer, and then get absolute position': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
@@ -1069,6 +1069,44 @@ Test.prototype.tests = {
|
||||
|
||||
layer.draw();
|
||||
},
|
||||
'TRANSFORMS - scale layer, rotate group, position shape, and then get absolute position': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer({
|
||||
scale: {
|
||||
x: 2,
|
||||
y: 2
|
||||
}
|
||||
});
|
||||
var group = new Kinetic.Group({
|
||||
x: 100,
|
||||
rotationDeg: 90
|
||||
});
|
||||
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 50,
|
||||
y: 10,
|
||||
width: 100,
|
||||
height: 50,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
draggable: true
|
||||
});
|
||||
|
||||
group.add(rect);
|
||||
layer.add(group);
|
||||
stage.add(layer);
|
||||
|
||||
// test absolute positions
|
||||
test(rect.getAbsolutePosition().x == 180, 'rect should be at x = 180');
|
||||
test(rect.getAbsolutePosition().y == 100, 'rect should be at y = 100');
|
||||
|
||||
layer.draw();
|
||||
},
|
||||
'SHAPES - hide circle': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
||||
Reference in New Issue
Block a user