Ticket #2151: scrolloffset.patch

File scrolloffset.patch, 1.4 KB (added by Christian Zagrodnick, 13 years ago)

Fix contextmenu position

  • editor/_source/internals/fcktools_gecko.js

     
    131131
    132132FCKTools.GetScrollPosition = function( relativeWindow )
    133133{
    134         return { X : relativeWindow.pageXOffset, Y : relativeWindow.pageYOffset } ;
     134    var x = 0;
     135    var y = 0;
     136    while ( relativeWindow && typeof relativeWindow.scrollTop == 'number' && typeof relativeWindow.scrollLeft == 'number' )
     137    {
     138        x += relativeWindow.scrollLeft;
     139        y += relativeWindow.scrollTop;
     140        relativeWindow = relativeWindow.parentNode;
     141    }
     142        return { X : x, Y : y } ;
    135143}
    136144
    137145FCKTools.AddEventListener = function( sourceObject, eventName, listener )
  • editor/_source/classes/fckpanel.js

     
    235235                        oPos.y -= nPos.y ;
    236236                }
    237237
     238        // Plus the offsets provided by parent of the master iframe.
     239        var oScrollPosition = FCKTools.GetScrollPosition( window.FCK.LinkedField.parentNode ) ;
     240        oPos.x += oScrollPosition.X;
     241        oPos.y += oScrollPosition.Y;
     242
    238243                if ( this.IsRTL && !this.IsContextMenu )
    239244                        x = ( x * -1 ) ;
    240245
© 2003 – 2021 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy