blackberry / bbUI.js

BlackBerry UI look and feel JavaScript toolkit for WebWorks
Apache License 2.0
312 stars 192 forks source link

Action and tab menu overflow items not centering correctly #961

Closed jcarabetta closed 10 years ago

jcarabetta commented 11 years ago

I don't know if this is a bug or if it's designed this way that action and tab menu items don't center correctly. There is "some" centering but the calculations are not exact. I solved it by changing the bbUI.js. I post it here so if this is a bug someone can provide a better fix than mine, if not then delete it or close it.

bbUI.js: For the Tab menu on line 4196 "menu.centerMenuItems" i changed "itemHeight" from 111 to 121 On line 4207 i changed: "margin = windowHeight - Math.floor(windowHeight/2) - Math.floor((this.actions.length * itemHeight)/2) - itemHeight;" for this: "margin = windowHeight - Math.round(windowHeight/2) - Math.round((this.actions.length * itemHeight)/2);"

For the Action menu on line 8608 "menu.centerMenuItems" i changed: "itemHeight" from 111 to 128. On line 8619 i changed "itemHeight" from 80 to 94. On line 8639 i changed: "margin = windowHeight - Math.floor(windowHeight/2) - Math.floor((numActions * itemHeight)/2) - headerHeight;" for this: if(bb.device.is720x720 || numActions < 6 || windowHeight > 768){ margin = windowHeight - Math.round(windowHeight/2) - Math.round((numActions * itemHeight)/2) - headerHeight; }else{ margin = 0; }"

The "if(bb.device.is720x720 || numActions < 6 || windowHeight > 768)" is made to remove the margin if the Z10 is in landscape mode, because with 6 items it has an unnecessary gap.

With this little changes i could center all items on the menus. Test it and tell me if it worked for you, if not i hope it gets fixed.

I tested this with Z10 and Q10 ripple and simulator, so i don't know if this works on Playbook.

tneil commented 10 years ago

I believe this is corrected in the latest updates