mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	now clicking an unfocused window will not close the overlay...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									ed0388e852
								
							
						
					
					
						commit
						ff6117c1c9
					
				| @ -1122,7 +1122,6 @@ var BrowserPrototype = { | ||||
| 					.map(function(e){ return e.replace(/\\(\s)/, '$1') }) | ||||
| 					.join('|')  | ||||
| 				+ ')', 'gi') | ||||
| 			console.log('>>>>', p, pattern) | ||||
| 			// XXX should this be case insensitive???
 | ||||
| 			this.filter(pattern, | ||||
| 					// rejected...
 | ||||
|  | ||||
| @ -55,6 +55,8 @@ var OverlayPrototype = { | ||||
| 			'click', | ||||
| 			'keydown', | ||||
| 		], | ||||
| 
 | ||||
| 		closeOnUnFocusedClick: false, | ||||
| 	}, | ||||
| 
 | ||||
| 	// XXX for some reason this does not work...
 | ||||
| @ -89,9 +91,35 @@ var OverlayPrototype = { | ||||
| 
 | ||||
| 		object.superMethod(Overlay, '__init__').call(this, parent, client, options) | ||||
| 
 | ||||
| 		// Prevent closing the overlay if clicked while blurred...
 | ||||
| 		// i.e.
 | ||||
| 		// 	1'st click -- focus window
 | ||||
| 		// 	2'nd click -- close overlay
 | ||||
| 		//
 | ||||
| 		// XXX HACK: need a better way to do this...
 | ||||
| 		var focused | ||||
| 		var unlock = function() { setTimeout(function(){ focused = true }, 200) } | ||||
| 		var lock = function() { focused = false } | ||||
| 		// blur-lock...
 | ||||
| 		$(window) | ||||
| 			.focus(unlock) | ||||
| 			.blur(lock) | ||||
| 		// cleanup...
 | ||||
| 		this.close(function(){ | ||||
| 			$(window) | ||||
| 				.off('focus', unlock) | ||||
| 				.off('blur', lock) | ||||
| 		}) | ||||
| 
 | ||||
| 		this.dom | ||||
| 			.click(function(){ | ||||
| 				if(that.options.closeOnUnFocusedClick || focused){ | ||||
| 					that.close() | ||||
| 
 | ||||
| 				// don't make the user wait if they really wants to close...
 | ||||
| 				} else { | ||||
| 					focused = true | ||||
| 				} | ||||
| 			}) | ||||
| 
 | ||||
| 		this.parent | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user