Changeset 487
- Timestamp:
- 2007-07-20 12:58:11 (17 months ago)
- Location:
- FCKeditor/trunk/editor
- Files:
-
- 3 modified
-
plugins/dragresizetable/fckplugin.js (modified) (11 diffs)
-
_source/commandclasses/fckfitwindow.js (modified) (1 diff)
-
_source/internals/fcktools.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/plugins/dragresizetable/fckplugin.js
r480 r487 10 10 "_MaximumX" : null, 11 11 "_LastX" : null, 12 "_GetWindowScrollX" : function( w )13 {14 var scrollX = 0 ;15 if ( w.document.documentElement && w.document.documentElement.scrollLeft )16 scrollX = w.document.documentElement.scrollLeft ;17 else if ( w.document.body && w.document.body.scrollLeft )18 scrollX = w.document.body.scrollLeft ;19 else if ( w.scrollX )20 scrollX = w.scrollX ;21 return scrollX ;22 },23 "_GetWindowScrollY" : function( w )24 {25 var scrollY = 0 ;26 if ( w.document.documentElement && w.document.documentElement.scrollTop )27 scrollY = w.document.documentElement.scrollTop ;28 else if ( w.document.body && w.document.body.scrollTop )29 scrollY = w.document.body.scrollTop ;30 else if ( w.scrollY )31 scrollY = w.scrollY ;32 return scrollY ;33 },34 "_GetDocumentPosition" : function( w, node )35 {36 var x = 0 ;37 var y = 0 ;38 var curNode = node ;39 while ( curNode && curNode != w.document.body )40 {41 x += curNode.offsetLeft - curNode.scrollLeft ;42 y += curNode.offsetTop - curNode.scrollTop ;43 curNode = curNode.offsetParent ;44 }45 return { "x" : x, "y" : y } ;46 },47 "_GetWindowPosition" : function( w, node )48 {49 var pos = this._GetDocumentPosition( w, node ) ;50 pos.x -= this._GetWindowScrollX( w ) ;51 pos.y -= this._GetWindowScrollY( w ) ;52 return pos ;53 },54 12 "_IsInsideNode" : function( w, domNode, pos ) 55 13 { 56 var myCoords = this._GetWindowPosition( w, domNode ) ;14 var myCoords = FCKTools.GetWindowPosition( w, domNode ) ; 57 15 var xMin = myCoords.x ; 58 16 var yMin = myCoords.y ; … … 85 43 for ( var i = 0 ; i < cells.length ; i++ ) 86 44 { 87 var pos = this._GetWindowPosition( w, cells[i] ) ;45 var pos = FCKTools.GetWindowPosition( w, cells[i] ) ; 88 46 var rightX = pos.x + parseInt( cells[i].clientWidth ) ; 89 47 var rxDist = mouse.x - rightX ; … … 105 63 106 64 // Abort if too far from the border. 107 lxDist = mouse.x - this._GetWindowPosition( w, lbCell ).x ;65 lxDist = mouse.x - FCKTools.GetWindowPosition( w, lbCell ).x ; 108 66 if ( lxDist < 0 && minRxDist < 0 && minRxDist < -2 ) 109 67 return null ; … … 140 98 // Calculate maximum and minimum x-coordinate delta. 141 99 var borderIndex = FCKDragTableHandler._GetResizeBarPosition() ; 142 var offset = FCK DragTableHandler._GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;100 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 143 101 var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" ); 144 102 var minX = null ; … … 151 109 { 152 110 var cell = row.cells.item( c ) ; 153 var cellPosition = FCK DragTableHandler._GetWindowPosition( FCK.EditorWindow, cell ) ;111 var cellPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, cell ) ; 154 112 var cellPadding = FCKDragTableHandler._GetCellPadding( table, cell ) ; 155 113 var cellMinX = cellPosition.x + cellPadding ; … … 365 323 if ( node.ownerDocument == document ) 366 324 { 367 var offset = this._GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;325 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 368 326 mouseX -= offset.x ; 369 327 mouseY -= offset.y ; … … 373 331 if ( this._ResizeBar && this._LeftCell ) 374 332 { 375 var leftPos = this._GetWindowPosition( FCK.EditorWindow, this._LeftCell ) ;376 var rightPos = this._GetWindowPosition( FCK.EditorWindow, this._RightCell ) ;333 var leftPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._LeftCell ) ; 334 var rightPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._RightCell ) ; 377 335 var rxDist = mouseX - ( leftPos.x + this._LeftCell.clientWidth ) ; 378 336 var lxDist = mouseX - rightPos.x ; … … 427 385 if ( node.ownerDocument == FCK.EditorDocument ) 428 386 { 429 var offset = this._GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;387 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 430 388 mouse.x += offset.x ; 431 389 mouse.y += offset.y ; … … 438 396 mouse.x = this._MinimumX + 5 ; 439 397 440 var docX = mouse.x + this._GetWindowScrollX( window );398 var docX = mouse.x + FCKTools.GetScrollPosition( window ).X ; 441 399 this._ResizeBar.style.left = ( docX - this._ResizeBar.offsetWidth / 2 ) + "px" ; 442 400 this._LastX = mouse.x ; … … 487 445 else 488 446 paddingBar.style.opacity = 0.1 ; 489 var offset = this._GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;490 var tablePos = this._GetWindowPosition( w, table ) ;447 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 448 var tablePos = FCKTools.GetWindowPosition( w, table ) ; 491 449 var barHeight = table.offsetHeight ; 492 450 var barTop = offset.y + tablePos.y ; … … 507 465 var barWidth = Math.max( bw+100, cs+100 ) ; 508 466 paddingBar.style.width = barWidth + "px" ; 509 paddingBar.style.left = ( offset.x + mouse.x + this._GetWindowScrollX( w )- barWidth / 2 ) + "px" ;467 paddingBar.style.left = ( offset.x + mouse.x + FCKTools.GetScrollPosition( w ).X - barWidth / 2 ) + "px" ; 510 468 var filler = paddingBar.getElementsByTagName( "img" )[0] ; 511 469 filler.style.width = paddingBar.offsetWidth + "px" ; -
FCKeditor/trunk/editor/_source/commandclasses/fckfitwindow.js
r132 r487 103 103 eMainWindow.scrollTo(0, 0); 104 104 105 // Is the editor still not on the top left? Let's find out and fix that as well. (Bug #174) 106 var editorPos = FCKTools.GetWindowPosition( eMainWindow, eEditorFrame ) ; 107 if ( editorPos.x != 0 ) 108 eEditorFrameStyle.left = ( -1 * editorPos.x ) + "px" ; 109 if ( editorPos.y != 0 ) 110 eEditorFrameStyle.top = ( -1 * editorPos.y ) + "px" ; 111 105 112 this.IsMaximized = true ; 106 113 } -
FCKeditor/trunk/editor/_source/internals/fcktools.js
r480 r487 446 446 return output.join( "" ) ; 447 447 } 448 449 FCKTools.GetDocumentPosition = function( w, node ) 450 { 451 var x = 0 ; 452 var y = 0 ; 453 var curNode = node ; 454 while ( curNode && curNode != w.document.body ) 455 { 456 x += curNode.offsetLeft - curNode.scrollLeft ; 457 y += curNode.offsetTop - curNode.scrollTop ; 458 curNode = curNode.offsetParent ; 459 } 460 return { "x" : x, "y" : y } ; 461 } 462 463 FCKTools.GetWindowPosition = function( w, node ) 464 { 465 var pos = this.GetDocumentPosition( w, node ) ; 466 var scroll = FCKTools.GetScrollPosition( w ) ; 467 pos.x -= scroll.X ; 468 pos.y -= scroll.Y ; 469 return pos ; 470 }