Implemented "a", "A". Added unit test for SVG "tiger" path (the canonical SVG example)

This commit is contained in:
Jason Follas
2012-06-05 23:56:46 -04:00
parent e74fa3a319
commit b61c688a83
4 changed files with 389 additions and 15 deletions

View File

@@ -1640,6 +1640,64 @@ Test.prototype.tests = {
stage.add(layer);
},
'SHAPE - arc': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 1024,
height: 480,
throttle: 80,
scale: 0.5,
x: 50,
y: 10
});
var layer = new Kinetic.Layer();
var c = "M100,350 l 50,-25 a25,25 -30 0,1 50,-25 l 50,-25 a25,50 -30 0,1 50,-25 l 50,-25 a25,75 -30 0,1 50,-25 l 50,-25 a25,100 -30 0,1 50,-25 l 50,-25";
var path = new Kinetic.Path({
data: c,
fill: 'none',
stroke: '#999',
strokeWidth: 1,
});
path.on('mouseover', function() {
this.setFill('red');
layer.draw();
});
path.on('mouseout', function() {
this.setFill('none');
layer.draw();
});
layer.add(path);
stage.add(layer);
},
'SHAPE - Tiger (RAWR!)': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 1024,
height: 480,
scale: 0.25,
x: 50,
y: 50
});
var layer = new Kinetic.Layer();
var group = new Kinetic.Group();
for (var i=0; i < tiger.length; i++)
{
var path = new Kinetic.Path(tiger[i]);
group.add(path);
}
group.draggable(true);
layer.add(group);
stage.add(layer);
},
'SHAPE - add shape with custom attr pointing to self': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,