combined Line, Spline, Blob, and Polygon into a single shape for more flexibility. converted allPoints property into cacheable getTensionPoints method

This commit is contained in:
Eric Rowell
2013-11-30 00:24:47 -08:00
parent 4fafde7451
commit 4b62ecea7c
10 changed files with 154 additions and 364 deletions

View File

@@ -4,7 +4,7 @@ suite('Blob', function(){
var stage = addStage();
var layer = new Kinetic.Layer();
var blob = new Kinetic.Blob({
var blob = new Kinetic.Line({
points: [{
x: 73,
y: 140
@@ -22,7 +22,8 @@ suite('Blob', function(){
strokeWidth: 10,
draggable: true,
fill: '#aaf',
tension: 0.8
tension: 0.8,
closed: true
});
layer.add(blob);
@@ -30,7 +31,7 @@ suite('Blob', function(){
assert.equal(blob.getTension(), 0.8);
assert.equal(blob.getClassName(), 'Blob');
assert.equal(blob.getClassName(), 'Line');
//console.log(blob1.getPoints())
@@ -48,7 +49,7 @@ suite('Blob', function(){
var layer = new Kinetic.Layer();
var blob = new Kinetic.Blob({
var blob = new Kinetic.Line({
tension: 0.8,
points: [{
x: 73,
@@ -66,14 +67,15 @@ suite('Blob', function(){
stroke: 'blue',
strokeWidth: 10,
draggable: true,
fill: '#aaf'
fill: '#aaf',
closed: true
});
layer.add(blob);
stage.add(layer);
assert.equal(stage.find('Blob')[0].getPoints().length, 4);
assert.equal(stage.find('Line')[0].getPoints().length, 4);
});
@@ -82,7 +84,7 @@ suite('Blob', function(){
var stage = addStage();
var layer = new Kinetic.Layer();
var blob = new Kinetic.Blob({
var blob = new Kinetic.Line({
points: [{
x: 73,
y: 140
@@ -100,7 +102,8 @@ suite('Blob', function(){
strokeWidth: 10,
draggable: true,
fill: '#aaf',
tension: 0.8
tension: 0.8,
closed: true
});
layer.add(blob);