Skip to content

Commit

Permalink
MDL-33728 Ensure that chooser dialogues are centred vertically
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Robert Nicols committed Jun 14, 2012
1 parent 60d3ff9 commit 7db2768
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/yui/chooserdialogue/chooserdialogue.js
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7db2768

Please sign in to comment.