uxebu / bonsai

BonsaiJS is a graphics library and renderer
http://bonsaijs.org
Other
1.96k stars 189 forks source link

New Rect().attr doesn't work with paramater which doens't exist #178

Closed wallynm closed 11 years ago

wallynm commented 11 years ago

At first, i don't know if a Rect is a Child of DisplayObject, and maybe i can be wrong, but the problem is, if you try to attr a property which doesn't exist on the base class they don't accept the attr and don't create the property.

I think it is a bug because of this i've found on the docs http://docs.bonsaijs.org/DisplayObject.html it says that you can attr the atribute foo or any attribute and access it just using attr('foo')

I don't know the code, so i dpn't know if it is a child of display object, but this option could be very handfull, even if he's not child...

basecode commented 11 years ago

That's right, attr doesn't work with random parameters. The example you're referring to is obviously confusing. Feel free to submit a pull-request with something more understandable. See: https://github.com/uxebu/bonsai/blob/master/src/runner/display_object.js#L560

Rect is a subclass of DisplayObject and inherits some attrs as described in the docs you're referring (See: "List of supported attribute names").