mirror of
https://github.com/konvajs/konva.git
synced 2025-05-04 21:27:51 +08:00
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
![]() |
Test.Modules.RECT = {
|
||
|
'draw rect': function(containerId) {
|
||
|
var stage = new Kinetic.Stage({
|
||
|
container: containerId,
|
||
|
width: 578,
|
||
|
height: 200
|
||
|
});
|
||
|
var layer = new Kinetic.Layer();
|
||
|
var rect = new Kinetic.Rect({
|
||
|
x: 200,
|
||
|
y: 90,
|
||
|
width: 100,
|
||
|
height: 50,
|
||
|
fill: 'green',
|
||
|
stroke: 'black',
|
||
|
strokeWidth: 4,
|
||
|
offset: {
|
||
|
x: 50
|
||
|
},
|
||
|
scale: [2, 2],
|
||
|
cornerRadius: 15,
|
||
|
draggable: true
|
||
|
});
|
||
|
|
||
|
layer.add(rect);
|
||
|
stage.add(layer);
|
||
|
},
|
||
|
'add stroke rect': function(containerId) {
|
||
|
var stage = new Kinetic.Stage({
|
||
|
container: containerId,
|
||
|
width: 578,
|
||
|
height: 200
|
||
|
});
|
||
|
var layer = new Kinetic.Layer();
|
||
|
var rect = new Kinetic.Rect({
|
||
|
x: 200,
|
||
|
y: 100,
|
||
|
width: 100,
|
||
|
height: 50,
|
||
|
stroke: 'green',
|
||
|
strokeWidth: 4
|
||
|
});
|
||
|
|
||
|
layer.add(rect);
|
||
|
stage.add(layer);
|
||
|
},
|
||
|
'use default stroke (stroke color should be black)': function(containerId) {
|
||
|
var stage = new Kinetic.Stage({
|
||
|
container: containerId,
|
||
|
width: 578,
|
||
|
height: 200
|
||
|
});
|
||
|
var layer = new Kinetic.Layer();
|
||
|
var rect = new Kinetic.Rect({
|
||
|
x: 200,
|
||
|
y: 100,
|
||
|
width: 100,
|
||
|
height: 50,
|
||
|
strokeWidth: 4
|
||
|
});
|
||
|
|
||
|
layer.add(rect);
|
||
|
stage.add(layer);
|
||
|
},
|
||
|
'use default stroke width (stroke width should be 2)': function(containerId) {
|
||
|
var stage = new Kinetic.Stage({
|
||
|
container: containerId,
|
||
|
width: 578,
|
||
|
height: 200
|
||
|
});
|
||
|
var layer = new Kinetic.Layer();
|
||
|
var rect = new Kinetic.Rect({
|
||
|
x: 200,
|
||
|
y: 100,
|
||
|
width: 100,
|
||
|
height: 50,
|
||
|
stroke: 'blue'
|
||
|
});
|
||
|
|
||
|
layer.add(rect);
|
||
|
stage.add(layer);
|
||
|
}
|
||
|
};
|