mirror of
https://github.com/konvajs/konva.git
synced 2025-09-20 03:18:00 +08:00
Bug fix for getAttr function
Now it permits to return user defined attributes which do not have a corresponding method, similar to setAttrs(config) that sets attributes as key-value whenever there is no method for the given key
This commit is contained in:
@@ -168,7 +168,13 @@
|
|||||||
*/
|
*/
|
||||||
getAttr: function(attr) {
|
getAttr: function(attr) {
|
||||||
var method = GET + Kinetic.Type._capitalize(attr);
|
var method = GET + Kinetic.Type._capitalize(attr);
|
||||||
return this[method]();
|
if(Kinetic.Type._isFunction(this[method])) {
|
||||||
|
return this[method]();
|
||||||
|
}
|
||||||
|
// otherwise get directly
|
||||||
|
else {
|
||||||
|
return this.attrs[attr];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* get attrs
|
* get attrs
|
||||||
|
Reference in New Issue
Block a user