Permalink
Browse files

MDL-30627 Ensure that the dialogue is always shown in the current vie…

…w window
  • Loading branch information...
1 parent 42f6b3f commit bc6b1799d76cc6cdf196c67bc6b258c05b533ea6 @andrewnicols andrewnicols committed Dec 7, 2011
Showing with 3 additions and 9 deletions.
  1. +0 −7 blocks/community/yui/comments/comments.js
  2. +3 −2 enrol/yui/notification/notification.js
@@ -31,13 +31,6 @@ YUI.add('moodle-block_community-comments', function(Y) {
this.overlays[commentid].render();
this.overlays[commentid].hide();
- // position the overlay in the middle of the web browser window
- var WidgetPositionAlign = Y.WidgetPositionAlign;
- this.overlays[commentid].set("align", {
- node:"", //empty => viewport
- points:[WidgetPositionAlign.CC, WidgetPositionAlign.CC]
- });
-
Y.one('#comments-'+commentid).on('click', this.show, this, commentid);
}
@@ -81,8 +81,9 @@ Y.extend(DIALOGUE, Y.Overlay, {
if (hidden) {
bb.setStyle('top', '-1000px').removeClass(DIALOGUE_PREFIX+'-hidden');
}
- var x = Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2);
- var y = Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2)+Y.one(window).get('scrollTop');
+ var x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15);
+ var y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop');
+
if (hidden) {
bb.addClass(DIALOGUE_PREFIX+'-hidden');
}

0 comments on commit bc6b179

Please sign in to comment.