fix a regression where filling a partially empty text list page after resize would not empty the page before

This commit is contained in:
rlx 2011-11-05 22:37:28 +00:00
parent c0f2473346
commit a24d139f9b

View file

@ -414,9 +414,10 @@ Ox.List = function(options, self) {
} }
function emptyFirstPage() { function emptyFirstPage() {
Ox.Log('!', 'EMPTY')
if (self.$pages[0]) { if (self.$pages[0]) {
if (self.options.type == 'text') { if (self.options.type == 'text') {
self.$pages[0].find('.OxEmpty').remove(); self.$pages[0].$element.find('.OxEmpty').remove();
} else if (self.options.orientation == 'both') { } else if (self.options.orientation == 'both') {
that.$content.css({height: getListSize() + 'px'}); that.$content.css({height: getListSize() + 'px'});
} }
@ -429,14 +430,14 @@ Ox.List = function(options, self) {
var height = getHeight(), var height = getHeight(),
lastItemHeight = height % self.options.itemHeight || self.options.itemHeight, lastItemHeight = height % self.options.itemHeight || self.options.itemHeight,
visibleItems = Math.ceil(height / self.options.itemHeight); visibleItems = Math.ceil(height / self.options.itemHeight);
//Ox.Log('List', 'FILL', self.listLength, visibleItems); Ox.Log('!', 'FILL', self.listLength, visibleItems);
if (self.listLength < visibleItems) { if (self.listLength < visibleItems) {
Ox.range(self.listLength, visibleItems).forEach(function(v) { Ox.range(self.listLength, visibleItems).forEach(function(i) {
var $item = Ox.ListItem({ var $item = Ox.ListItem({
construct: self.options.construct, construct: self.options.construct,
}); });
$item.addClass('OxEmpty').removeClass('OxTarget'); $item.addClass('OxEmpty').removeClass('OxTarget');
if (v == visibleItems - 1) { if (i == visibleItems - 1) {
$item.$element.css({ $item.$element.css({
height: lastItemHeight + 'px', height: lastItemHeight + 'px',
overflowY: 'hidden' overflowY: 'hidden'