mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
44 lines
896 B
JavaScript
44 lines
896 B
JavaScript
Test.Modules.POLYGON - {
|
|
'add polygon': function(containerId) {
|
|
var stage = new Kinetic.Stage({
|
|
container: containerId,
|
|
width: 578,
|
|
height: 200
|
|
});
|
|
var layer = new Kinetic.Layer();
|
|
|
|
var points = [{
|
|
x: 73,
|
|
y: 192
|
|
}, {
|
|
x: 73,
|
|
y: 160
|
|
}, {
|
|
x: 340,
|
|
y: 23
|
|
}, {
|
|
x: 500,
|
|
y: 109
|
|
}, {
|
|
x: 499,
|
|
y: 139
|
|
}, {
|
|
x: 342,
|
|
y: 93
|
|
}];
|
|
|
|
var poly = new Kinetic.Polygon({
|
|
points: points,
|
|
fill: 'green',
|
|
stroke: 'blue',
|
|
strokeWidth: 5
|
|
});
|
|
|
|
layer.add(poly);
|
|
stage.add(layer);
|
|
|
|
test(poly.getClassName() === 'Polygon', 'getClassName should be Polygon');
|
|
|
|
}
|
|
};
|