Extend Kinetc.Shape and all derived shapes-Collection of common programming errors
I want to extend the object Kinetic.Shape
(from which every other shape extends) with some more properties and methods.
What I tried was
Kinetic.Util.addMethods(Kinetic.Shape, {
foo: 'bar'
});
So say if I created a new Kinetic.Circle
instance, it should contain this defined property ( and every other shape should do so to).
new Kinetic.Circle(options).foo; // returns undefined
// should return 'bar'
How can I achieve this behaviour?
Originally posted 2013-11-10 00:09:04.