Fixed listener not removing after context menu closes

This commit is contained in:
xevidos 2019-01-22 14:43:05 -05:00
parent 1e1726f3e2
commit e2683fa5c7
2 changed files with 12 additions and 15 deletions

View file

@ -205,15 +205,12 @@
.removeClass('disabled');
}
// Hide menu
$('#file-manager, #editor-region')
.on('mouseover', function() {
/**
* make sure that the user has moved their mouse far enough
* away from the context menu to warrant a close.
*/
$('#file-manager, #editor-region').on( 'mousemove', codiad.filemanager.contextCheckMouse );
});
/* Notify listeners. */
amplify.publish('context-menu.onShow', {e: e, path: path, type: type});
// Hide on click
@ -226,11 +223,11 @@
contextCheckMouse: function( e ) {
let offset = $('#context-menu').offset();
let bottom = offset.top + $('#context-menu').outerHeight( true ) + 10;
let left = offset.left - 10;
let right = offset.left + $('#context-menu').outerWidth( true ) + 10;
let top = offset.top - 10;
console.log( e );
let bottom = offset.top + $('#context-menu').outerHeight( true ) + 20;
let left = offset.left - 20;
let right = offset.left + $('#context-menu').outerWidth( true ) + 20;
let top = offset.top - 20;
if( ( e.clientX > right || e.clientX < left ) || ( e.clientY > bottom || e.clientY < top ) ) {
$('#file-manager, #editor-region').off( 'mousemove', codiad.filemanager.contextCheckMouse );

View file

@ -12,7 +12,7 @@ class Update {
// CONSTANTS
//////////////////////////////////////////////////////////////////
CONST VERSION = "v.2.9.3.4";
CONST VERSION = "v.2.9.3.5";
//////////////////////////////////////////////////////////////////
// PROPERTIES