mirror of
https://github.com/konvajs/konva.git
synced 2025-10-14 20:04:52 +08:00
tests for drag distance
This commit is contained in:
@@ -1523,6 +1523,38 @@ suite('Node', function() {
|
||||
assert.equal(Math.round(marker.getAbsolutePosition().y), Math.round(diagonal / 2), 'marker absolute position y should be about ' + Math.round(diagonal / 2) + ' but is about ' + Math.round(marker.getAbsolutePosition().y));
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('test dragDistance', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
var rect1 = new Kinetic.Rect({
|
||||
x: 1,
|
||||
y: 2,
|
||||
width: 100,
|
||||
height: 50,
|
||||
fill: 'red'
|
||||
});
|
||||
|
||||
var group = new Kinetic.Group({
|
||||
dragDistance : 2
|
||||
});
|
||||
|
||||
var rect2 = new Kinetic.Rect({
|
||||
x: 3,
|
||||
width: 100,
|
||||
height: 50,
|
||||
fill: 'red'
|
||||
});
|
||||
group.add(rect2);
|
||||
|
||||
layer.add(rect1).add(group);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(rect1.dragDistance(), 0);
|
||||
assert.equal(group.dragDistance(), 2);
|
||||
assert.equal(rect2.dragDistance(), 2);
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('translate, rotate, scale shape', function() {
|
||||
var stage = addStage();
|
||||
|
Reference in New Issue
Block a user