diff --git a/source/Ox.UI/css/Ox.UI.css b/source/Ox.UI/css/Ox.UI.css index 1b9f9675..1e5cb23c 100644 --- a/source/Ox.UI/css/Ox.UI.css +++ b/source/Ox.UI/css/Ox.UI.css @@ -918,7 +918,11 @@ Lists //left: -2px; } -.OxIconList .OxItem > .OxIcon img { +.OxIconList .OxItem > .OxIcon { + overflow: hidden; +} + +.OxIconList .OxItem > .OxIcon > img { position: absolute; left: 0; right: 0; diff --git a/source/Ox.UI/js/List/Ox.IconItem.js b/source/Ox.UI/js/List/Ox.IconItem.js index b1afe2da..eec236b6 100644 --- a/source/Ox.UI/js/List/Ox.IconItem.js +++ b/source/Ox.UI/js/List/Ox.IconItem.js @@ -7,13 +7,14 @@ Ox.IconItem IconItem Object (options, self) -> IconItem Object options Options object borderRadius border radius for icon images - fixedRatio if set to a number, icons have a fixed ratio - height icon height + iconHeight icon height + iconWidth icon width + imageHeight icon image height + imageWidth icon image width id element id info icon info size icon size title title - width icon width url icon url self shared private variable @*/ @@ -26,38 +27,40 @@ Ox.IconItem = function(options, self) { var that = Ox.Element({}, self) .defaults({ borderRadius: 0, - fixedRatio: false, - height: 128, + iconHeight: 128, + iconWidth: 128, + imageHeight: 128, + imageWidth: 128, + itemHeight: 192, + itemWidth: 128, id: '', info: '', - size: 128, title: '', - width: 128, url: '' }) .options(options || {}); $.extend(self, { - fontSize: self.options.size == 64 ? 6 : 9, - height: self.options.size * 1.5, - lineLength: self.options.size == 64 ? 15 : 23, - lines: self.options.size == 64 ? 4 : 5, + fontSize: self.options.itemWidth == 64 ? 6 : 9, + lineLength: self.options.itemWidth == 64 ? 15 : 23, + lines: self.options.itemWidth == 64 ? 4 : 5, url: Ox.UI.PATH + 'png/transparent.png', - width: self.options.size }); self.title = formatText(self.options.title, self.lines - 1, self.lineLength); self.info = formatText(self.options.info, 5 - self.title.split('
').length, self.lineLength); + Ox.print('SELF OPTIONS', self.options) + that.css({ - width: self.width + 'px', - height: self.height + 'px' + width: self.options.itemWidth + 'px', + height: self.options.itemHeight + 'px' }); that.$icon = $('
') .addClass('OxIcon') .css({ - top: self.options.size == 64 ? -64 : -124, - width: (self.options.size + 4) + 'px', - height: (self.options.size + 4) + 'px' + top: self.options.iconWidth == 64 ? -64 : -124, + width: (self.options.iconWidth + 4) + 'px', + height: (self.options.iconHeight + 4) + 'px' }); that.$iconImage = $('') .addClass('OxLoading OxTarget') @@ -65,8 +68,8 @@ Ox.IconItem = function(options, self) { src: self.url }) .css({ - width: self.options.width + 'px', - height: self.options.height + 'px', + width: self.options.imageWidth + 'px', + height: self.options.imageHeight + 'px', borderRadius: self.options.borderRadius + 4 + 'px' }) .mousedown(mousedown) @@ -76,9 +79,9 @@ Ox.IconItem = function(options, self) { that.$textBox = $('
') .addClass('OxText') .css({ - top: (self.options.size / 2) + 'px', - width: (self.options.size + 4) + 'px', - height: (self.options.size == 64 ? 30 : 58) + 'px' + top: self.options.iconHeight - self.options.itemWidth / 2 + 'px', + width: self.options.itemWidth + 4 + 'px', + height: (self.options.itemWidth == 64 ? 30 : 58) + 'px' }); that.$text = $('
') .addClass('OxTarget') @@ -93,9 +96,9 @@ Ox.IconItem = function(options, self) { that.$reflection = $('
') .addClass('OxReflection') .css({ - top: self.options.size + 'px', - width: (self.options.size + 4) + 'px', - height: (self.options.size / 2) + 'px' + top: self.options.iconHeight + 'px', + width: self.options.itemWidth + 4 + 'px', + height: self.options.itemHeight - self.options.iconHeight + 'px' }); that.$reflectionImage = $('') .addClass('OxLoading') @@ -103,17 +106,17 @@ Ox.IconItem = function(options, self) { src: self.url }) .css({ - width: self.options.width + 'px', - height: self.options.height + 'px', + width: self.options.imageWidth + 'px', + height: self.options.imageHeight + 'px', // firefox is 1px off when centering images with odd width and scaleY(-1) - paddingLeft: ($.browser.mozilla && self.options.width % 2 ? 1 : 0) + 'px', - borderRadius: self.options.borderRadius + 4 + 'px' + paddingLeft: ($.browser.mozilla && self.options.imageWidth % 2 ? 1 : 0) + 'px', + borderRadius: self.options.borderRadius + 'px' }); that.$gradient = $('
') .css({ //top: (-self.options.size / 2) + 'px', - width: self.options.size + 'px', - height: (self.options.size / 2) + 'px' + width: self.options.itemWidth + 'px', + height: self.options.itemWidth / 2 + 'px' }); that.append( @@ -174,6 +177,7 @@ Ox.IconItem = function(options, self) { that.removeClass('OxHover'); } + Ox.print('CSS HEIGHT', that.css('height')) return that; }; diff --git a/source/Ox.UI/js/List/Ox.IconList.js b/source/Ox.UI/js/List/Ox.IconList.js index a4791d85..39aec124 100644 --- a/source/Ox.UI/js/List/Ox.IconList.js +++ b/source/Ox.UI/js/List/Ox.IconList.js @@ -53,10 +53,10 @@ Ox.IconList = function(options, self) { self.options.defaultRatio = self.options.fixedRatio; } - $.extend(self, { - itemHeight: self.options.size * 1.5, - itemWidth: self.options.size - }); + self.iconHeight = self.options.size / (self.options.fixedRatio || 1); + self.iconWidth = self.options.size; + self.itemHeight = self.iconHeight + self.options.size * 0.5; + self.itemWidth = self.options.size; that.$element = Ox.List({ centered: self.options.centered, @@ -89,15 +89,27 @@ Ox.IconList = function(options, self) { function constructItem(data) { var isEmpty = Ox.isEmpty(data); - data = !isEmpty ? - self.options.item(data, self.options.sort, self.options.size) : {} - ratio = !isEmpty ? data.width / data.height : self.options.defaultRatio; + data = !isEmpty + ? self.options.item(data, self.options.sort, self.options.size) + : { + width: Math.round(self.options.size * ( + self.options.defaultRatio >= 1 ? 1 : self.options.defaultRatio + )), + height: Math.round(self.options.size / ( + self.options.defaultRatio <= 1 ? 1 : self.options.defaultRatio + )) + }; return self.options.itemConstructor($.extend(data, { borderRadius: self.options.borderRadius, - fixedRatio: self.options.fixedRatio, - height: Math.round(self.options.size / (ratio <= 1 ? 1 : ratio)), - size: self.options.size, - width: Math.round(self.options.size * (ratio >= 1 ? 1 : ratio)) + iconHeight: self.iconHeight, + iconWidth: self.iconWidth, + imageHeight: data.height, + imageWidth: data.width, + itemHeight: self.itemHeight, + itemWidth: self.itemWidth, + //height: Math.round(self.options.size / (ratio <= 1 ? 1 : ratio)), + //size: self.options.size, + //width: Math.round(self.options.size * (ratio >= 1 ? 1 : ratio)) })); } diff --git a/source/Ox.UI/js/List/Ox.ListItem.js b/source/Ox.UI/js/List/Ox.ListItem.js index 9e74e412..d639e389 100644 --- a/source/Ox.UI/js/List/Ox.ListItem.js +++ b/source/Ox.UI/js/List/Ox.ListItem.js @@ -21,7 +21,7 @@ Ox.ListItem = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ - construct: function() {}, + construct: null, data: {}, draggable: false, position: 0,