added getNodeType() and getShapeType() methods

This commit is contained in:
Eric Rowell
2013-03-24 00:14:42 -07:00
parent f0037ce9c6
commit 542f675522
18 changed files with 83 additions and 4 deletions

View File

@@ -926,6 +926,14 @@
go._addName(this, name);
this.setAttr(NAME, name);
},
/**
* get node type. Returns 'Stage', 'Layer', 'Group', or 'Shape'
* @name getNodeType
* @methodOf Kinetic.Node.prototype
*/
getNodeType: function() {
return this.nodeType;
},
setAttr: function(key, val) {
var oldVal;
if(val !== undefined) {

View File

@@ -163,6 +163,14 @@
disableDashArray: function() {
this.setAttr('dashArrayEnabled', false);
},
/**
* get shape type. Ex. 'Circle', 'Rect', 'Text', etc.
* @name getShapeType
* @methodOf Kinetic.Shape.prototype
*/
getShapeType: function() {
return this.shapeType;
},
remove: function() {
Kinetic.Node.prototype.remove.call(this);
delete Kinetic.Global.shapes[this.colorKey];