Ox.IconList: don't require 'keys' option if 'items' is a local array

This commit is contained in:
rolux 2012-07-02 18:21:09 +02:00
parent 6f4ee1229f
commit f5aa547f43

View file

@ -74,6 +74,14 @@ Ox.IconList = function(options, self) {
self.options.defaultRatio = self.options.fixedRatio; self.options.defaultRatio = self.options.fixedRatio;
} }
if (Ox.isArray(self.options.items)) {
self.options.keys = Ox.unique(Ox.flatten(
self.options.items.map(function(item) {
return Object.keys(item);
})
));
}
self.iconWidth = self.options.size; self.iconWidth = self.options.size;
self.iconHeight = self.options.fixedRatio > 1 self.iconHeight = self.options.fixedRatio > 1
? Math.round(self.options.size / self.options.fixedRatio) ? Math.round(self.options.size / self.options.fixedRatio)