mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 23:05:35 +00:00
Merge "Fix callout position when popup widget has been moved"
This commit is contained in:
commit
01a0ae93b9
|
@ -134,7 +134,7 @@ ve.ui.PopupWidget.prototype.hide = function () {
|
||||||
*/
|
*/
|
||||||
ve.ui.PopupWidget.prototype.display = function ( x, y, width, height, transition ) {
|
ve.ui.PopupWidget.prototype.display = function ( x, y, width, height, transition ) {
|
||||||
var left, overlapLeft, overlapRight,
|
var left, overlapLeft, overlapRight,
|
||||||
padding = 15;
|
overlapOffset = 0, padding = 7;
|
||||||
|
|
||||||
switch ( this.align ) {
|
switch ( this.align ) {
|
||||||
case 'left':
|
case 'left':
|
||||||
|
@ -155,9 +155,9 @@ ve.ui.PopupWidget.prototype.display = function ( x, y, width, height, transition
|
||||||
overlapRight = this.$$( 'body' ).width() - ( x + ( width + left + ( padding * 2 ) ) );
|
overlapRight = this.$$( 'body' ).width() - ( x + ( width + left + ( padding * 2 ) ) );
|
||||||
overlapLeft = x + ( left - ( padding * 2 ) );
|
overlapLeft = x + ( left - ( padding * 2 ) );
|
||||||
if ( overlapRight < 0 ) {
|
if ( overlapRight < 0 ) {
|
||||||
left += overlapRight;
|
overlapOffset = overlapRight;
|
||||||
} else if ( overlapLeft < 0 ) {
|
} else if ( overlapLeft < 0 ) {
|
||||||
left -= overlapLeft;
|
overlapOffset -= overlapLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent transition from being interrupted
|
// Prevent transition from being interrupted
|
||||||
|
@ -176,7 +176,7 @@ ve.ui.PopupWidget.prototype.display = function ( x, y, width, height, transition
|
||||||
|
|
||||||
// Position body relative to anchor and adjust size
|
// Position body relative to anchor and adjust size
|
||||||
this.$body.css( {
|
this.$body.css( {
|
||||||
'left': left, 'width': width, 'height': height === undefined ? 'auto' : height
|
'left': left + overlapOffset, 'width': width, 'height': height === undefined ? 'auto' : height
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue