Changeset 1320

Show
Ignore:
Timestamp:
2008-01-15 13:12:05 (2 years ago)
Author:
fredck
Message:

The current IFRAME position is now saved on mouse down. The new positions are then saved in a variable while moving, so we don't have to retrieve the current IFRAME position from computed styles on each call to the function. The dragMouseMoveHandler function is now more than 3 times faster.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/floating_dialog/editor/fckdialog.html

    r1317 r1320  
    277277{ 
    278278        var registeredWindows = [] ; 
    279         var lastCoords = null ; 
     279        var lastCoords ; 
     280        var currentPos ; 
    280281         
    281282        var cleanUpHandlers = function() 
     
    296297                        evt = FCKTools.GetElementDocument( this ).parentWindow.event ; 
    297298 
    298                 var currentCoords = {'x' : evt.screenX, 'y' : evt.screenY}; 
    299                 var dx = currentCoords.x - lastCoords.x; 
    300                 var dy = currentCoords.y - lastCoords.y; 
    301                 lastCoords = currentCoords; 
    302  
    303                 var x = parseInt( FCKDomTools.GetCurrentElementStyle( Args().TopWindow, frameElement, 'left' ) ) + dx ; 
    304                 var y = parseInt( FCKDomTools.GetCurrentElementStyle( Args().TopWindow, frameElement, 'top' ) ) + dy ; 
    305  
    306                 frameElement.style.left = x + 'px' ; 
    307                 frameElement.style.top  = y + 'px' ; 
     299                // Updated the last coordinates. 
     300                var currentCords = 
     301                { 
     302                        x : evt.screenX, 
     303                        y : evt.screenY 
     304                } ; 
     305 
     306                currentPos = 
     307                { 
     308                        x : currentPos.x + ( currentCords.x - lastCoords.x ), 
     309                        y : currentPos.y + ( currentCords.y - lastCoords.y ) 
     310                } ; 
     311 
     312                lastCoords = currentCords ; 
     313 
     314                frameElement.style.left = currentPos.x + 'px' ; 
     315                frameElement.style.top  = currentPos.y + 'px' ; 
    308316 
    309317                if ( evt.preventDefault ) 
     
    340348                                return ; 
    341349 
    342                         lastCoords = {'x' : evt.screenX, 'y' : evt.screenY} ; 
     350                        lastCoords =  
     351                        { 
     352                                x : evt.screenX,  
     353                                y : evt.screenY 
     354                        } ; 
     355 
     356                        // Save the current IFRAME position. 
     357                        currentPos =  
     358                        { 
     359                                x : parseInt( FCKDomTools.GetCurrentElementStyle( Args().TopWindow, frameElement, 'left' ) ), 
     360                                y : parseInt( FCKDomTools.GetCurrentElementStyle( Args().TopWindow, frameElement, 'top' ) ) 
     361                        } ; 
    343362 
    344363                        for ( var i = 0 ; i < registeredWindows.length ; i++ )