Changeset 30817
- Timestamp:
- 12/11/2014 09:33:46 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/editor-expand.js
r30743 r30817 804 804 } ); 805 805 806 function recalcEditorRect() { 807 editorRect = $editor.offset(); 808 editorRect.right = editorRect.left + $editor.outerWidth(); 809 editorRect.bottom = editorRect.top + $editor.outerHeight(); 810 } 811 806 812 function activate() { 807 813 if ( ! _isActive ) { … … 910 916 // Always recalculate the editor area entering the overlay with the mouse. 911 917 .on( 'mouseenter.focus', function() { 912 editorRect = $editor.offset(); 913 editorRect.right = editorRect.left + $editor.outerWidth(); 914 editorRect.bottom = editorRect.top + $editor.outerHeight(); 918 recalcEditorRect(); 915 919 916 920 $window.on( 'scroll.focus', function() { … … 938 942 // Fade in when the mouse moves away form the editor area. 939 943 .on( 'mousemove.focus', function( event ) { 940 var nx = event.pageX, 941 ny = event.pageY; 944 var nx = event.clientX, 945 ny = event.clientY, 946 pageYOffset = window.pageYOffset, 947 pageXOffset = window.pageXOffset; 942 948 943 949 if ( x && y && ( nx !== x || ny !== y ) ) { 944 950 if ( 945 ( ny <= y && ny < editorRect.top ) ||946 ( ny >= y && ny > editorRect.bottom ) ||947 ( nx <= x && nx < editorRect.left ) ||948 ( nx >= x && nx > editorRect.right )951 ( ny <= y && ny < editorRect.top - pageYOffset ) || 952 ( ny >= y && ny > editorRect.bottom - pageYOffset ) || 953 ( nx <= x && nx < editorRect.left - pageXOffset ) || 954 ( nx >= x && nx > editorRect.right - pageXOffset ) 949 955 ) { 950 956 traveledX += Math.abs( x - nx ); … … 952 958 953 959 if ( ( 954 ny <= editorRect.top - buffer ||955 ny >= editorRect.bottom + buffer ||956 nx <= editorRect.left - buffer ||957 nx >= editorRect.right + buffer 960 ny <= editorRect.top - buffer - pageYOffset || 961 ny >= editorRect.bottom + buffer - pageYOffset || 962 nx <= editorRect.left - buffer - pageXOffset || 963 nx >= editorRect.right + buffer - pageXOffset 958 964 ) && ( 959 965 traveledX > 10 || … … 1152 1158 editor.on( 'focus', focus ); 1153 1159 editor.on( 'blur', blur ); 1160 editor.on( 'wp-autoresize', recalcEditorRect ); 1154 1161 }; 1155 1162 … … 1159 1166 editor.off( 'focus', focus ); 1160 1167 editor.off( 'blur', blur ); 1168 editor.off( 'wp-autoresize', recalcEditorRect ); 1161 1169 }; 1162 1170
Note: See TracChangeset
for help on using the changeset viewer.