fix icon list 'centered' option and animation

This commit is contained in:
rolux 2012-12-13 02:25:32 +01:00
parent db26a8fb62
commit e3e3540ef3
2 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,7 @@
Ox.IconList <f> IconList Object Ox.IconList <f> IconList Object
options <o> Options object options <o> Options object
borderRadius <n|0> border radius for icon images borderRadius <n|0> border radius for icon images
centerSelection <b|false> scroll list so selection is always centered centered <b|false> scroll list so selection is always centered
defaultRatio <n|1> aspect ratio of icon placeholders defaultRatio <n|1> aspect ratio of icon placeholders
draggable <b|false> If true, items can be dragged draggable <b|false> If true, items can be dragged
fixedRatio <b|n|false> if set to a number, icons have a fixed ratio fixedRatio <b|n|false> if set to a number, icons have a fixed ratio
@ -33,7 +33,7 @@ Ox.IconList = function(options, self) {
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
borderRadius: 0, borderRadius: 0,
centerSelection: false, centered: false,
defaultRatio: 1, defaultRatio: 1,
draggable: false, draggable: false,
find: '', find: '',

View file

@ -1089,7 +1089,7 @@ Ox.List = function(options, self) {
size; size;
if (self.options.orientation == 'horizontal') { if (self.options.orientation == 'horizontal') {
if (self.options.centered) { if (self.options.centered) {
that.animate({ that.stop().animate({
scrollLeft: self.listMargin / 2 + (pos + 0.5) * itemWidth scrollLeft: self.listMargin / 2 + (pos + 0.5) * itemWidth
- that.width() / 2 + 'px' - that.width() / 2 + 'px'
}, 250); }, 250);