mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 14:56:20 +00:00
Fix callout position when popup widget has been moved
We calculate an overlap offset for when the popup widget has been moved to avoid going out of the viewport, but that offset is only applied to the body and not the callout. Change-Id: Ib9d08d60ccfa6562378640c526faf1e8363abbba
This commit is contained in:
parent
2c421258f8
commit
6b5ed9c711
|
@ -134,7 +134,7 @@ ve.ui.PopupWidget.prototype.hide = function () {
|
|||
*/
|
||||
ve.ui.PopupWidget.prototype.display = function ( x, y, width, height, transition ) {
|
||||
var left, overlapLeft, overlapRight,
|
||||
padding = 15;
|
||||
overlapOffset = 0, padding = 7;
|
||||
|
||||
switch ( this.align ) {
|
||||
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 ) ) );
|
||||
overlapLeft = x + ( left - ( padding * 2 ) );
|
||||
if ( overlapRight < 0 ) {
|
||||
left += overlapRight;
|
||||
overlapOffset = overlapRight;
|
||||
} else if ( overlapLeft < 0 ) {
|
||||
left -= overlapLeft;
|
||||
overlapOffset -= overlapLeft;
|
||||
}
|
||||
|
||||
// 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
|
||||
this.$body.css( {
|
||||
'left': left, 'width': width, 'height': height === undefined ? 'auto' : height
|
||||
'left': left + overlapOffset, 'width': width, 'height': height === undefined ? 'auto' : height
|
||||
} );
|
||||
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue