mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
circle attrs sync
This commit is contained in:
@@ -183,6 +183,35 @@ suite('Circle', function(){
|
||||
stroke: 'black',
|
||||
strokeWidth: 4
|
||||
});
|
||||
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(circle.getWidth(), 140);
|
||||
assert.equal(circle.attrs.height, 140);
|
||||
assert.equal(circle.getHeight(), 140);
|
||||
|
||||
circle.setWidth(100);
|
||||
assert.equal(circle.radius(), 50);
|
||||
assert.equal(circle.getHeight(), 100);
|
||||
|
||||
circle.setHeight(120);
|
||||
assert.equal(circle.radius(), 60);
|
||||
assert.equal(circle.getHeight(), 120);
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('attrs sync', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
var circle = new Kinetic.Circle({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4
|
||||
});
|
||||
layer.add(circle);
|
||||
|
||||
circle.setFill('blue');
|
||||
|
Reference in New Issue
Block a user