phlsa / gmynd-old

A toolkit that makes creating graphics easy
2 stars 0 forks source link

Improving Collections and Nesting #6

Closed bohnacker closed 11 years ago

bohnacker commented 11 years ago

Wouldn't it be good to nest Collections into divs (or make them to BaseObjects as well)? This would allow to attach events to it or making them children of other objects. Having an empty shape (= Node) would be good too for making hierarchical structures.

phlsa commented 11 years ago

Sounds good! Currently collections are just arrays (which is nice because you can iterate over them), but maybe we could do it like this:

var col = CreateCollection( function( count ) {
  return CreateShape( ... );
});

// collections automatically place their items in the children-object of the collection (which is just an object), so it can be iterated over
col.children.forEach( function( item ) {
  item.set({ ... });
});
phlsa commented 11 years ago

7e9351deba83d9ec45043e8925efd3917f07fdef should solve this.