MDL-33728 Ensure that chooser dialogues are centred vertically

This commit is contained in:
Andrew Robert Nicols 2012-06-14 10:55:16 +01:00
parent 60d3ff94db
commit 7db27680f8

View file

@ -152,6 +152,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
var bb = this.overlay.get('boundingBox');
var winheight = bb.get('winHeight');
var winwidth = bb.get('winWidth');
var offsettop = 0;
// Try and set a sensible max-height -- this must be done before setting the top
@ -187,6 +188,13 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
// We need to set the height for the yui3-widget - can't work
// out what we're setting at present -- shoud be the boudingBox
bb.setStyle('top', dialoguetop + 'px');
// Calculate the left location of the chooser
// We don't set a minimum width in the same way as we do height as the width would be far lower than the
// optimal width for moodle anyway.
var dialoguewidth = bb.get('offsetWidth');
var dialogueleft = (winwidth - dialoguewidth) / 2;
bb.setStyle('left', dialogueleft + 'px');
},
handle_key_press : function(e) {