mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	working on top drawer (partial)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									3b9ca219c9
								
							
						
					
					
						commit
						3a5e8bca5a
					
				| @ -34,6 +34,10 @@ | |||||||
| 
 | 
 | ||||||
| 	box-shadow: rgba(0, 0, 0, 0.1) 0.3em 0.3em 5em; | 	box-shadow: rgba(0, 0, 0, 0.1) 0.3em 0.3em 5em; | ||||||
| } | } | ||||||
|  | .drawer-widget.top .content { | ||||||
|  | 	top: auto; | ||||||
|  | 	margin-bottom: 100%; | ||||||
|  | } | ||||||
| .drawer-widget~.drawer-widget .content { | .drawer-widget~.drawer-widget .content { | ||||||
| 	box-shadow: rgba(0, 0, 0, 0.05) 0.1em 0.1em 3em; | 	box-shadow: rgba(0, 0, 0, 0.05) 0.1em 0.1em 3em; | ||||||
| } | } | ||||||
|  | |||||||
| @ -386,6 +386,28 @@ module.makeUIDialog = function(a, b){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | var makeDrawer = function(direction){ | ||||||
|  | 	return makeUIContainer(function(dialog, options){ | ||||||
|  | 		var parent = (options || {}).parentElement  | ||||||
|  | 		parent = parent ? $(parent) : this.ribbons.viewer  | ||||||
|  | 
 | ||||||
|  | 		options.direction = direction || 'bottom' | ||||||
|  | 
 | ||||||
|  | 		var d = drawer.Drawer( | ||||||
|  | 				parent, | ||||||
|  | 				dialog,  | ||||||
|  | 				options) | ||||||
|  | 		// we need to clear other ui elements, like the status bar...
 | ||||||
|  | 		// XXX is this the right way to go???
 | ||||||
|  | 		d.dom.css({ | ||||||
|  | 			'z-index': 5000, | ||||||
|  | 		}) | ||||||
|  | 
 | ||||||
|  | 		return d | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------
 | //---------------------------------------------------------------------
 | ||||||
| 
 | 
 | ||||||
| @ -432,34 +454,14 @@ var DialogsActions = actions.Actions({ | |||||||
| 		})], | 		})], | ||||||
| 	// XXX should this be renamed to BottomDrawer???
 | 	// XXX should this be renamed to BottomDrawer???
 | ||||||
| 	Drawer: ['- Interface/', | 	Drawer: ['- Interface/', | ||||||
| 		makeUIContainer(function(dialog, options){ | 		makeDrawer('bottom')], | ||||||
| 			var parent = (options || {}).parentElement  |  | ||||||
| 			parent = parent ? $(parent) : this.ribbons.viewer  |  | ||||||
| 
 |  | ||||||
| 			var d = drawer.Drawer( |  | ||||||
| 					parent, |  | ||||||
| 					dialog,  |  | ||||||
| 					options) |  | ||||||
| 			// we need to clear other ui elements, like the status bar...
 |  | ||||||
| 			// XXX is this the right way to go???
 |  | ||||||
| 			d.dom.css({ |  | ||||||
| 				'z-index': 5000, |  | ||||||
| 			}) |  | ||||||
| 
 |  | ||||||
| 			return d |  | ||||||
| 		})], |  | ||||||
| 	 | 	 | ||||||
| 	// XXX not implemented yet...
 | 	// XXX not implemented yet...
 | ||||||
| 	TopDrawer: ['- Interface/', | 	TopDrawer: ['- Interface/', | ||||||
| 		makeUIContainer(function(dialog, options){ | 		makeDrawer('top')], | ||||||
| 			// XXX
 |  | ||||||
| 			console.error('Not yet implemented.') |  | ||||||
| 		})], |  | ||||||
| 	BottomDrawer: ['- Interface/', | 	BottomDrawer: ['- Interface/', | ||||||
| 		makeUIContainer(function(dialog, options){ | 		makeDrawer('bottom')], | ||||||
| 			// XXX
 | 
 | ||||||
| 			console.error('Not yet implemented.') |  | ||||||
| 		})], |  | ||||||
| 	RightDrawer: ['- Interface/', | 	RightDrawer: ['- Interface/', | ||||||
| 		makeUIContainer(function(dialog, options){ | 		makeUIContainer(function(dialog, options){ | ||||||
| 			// XXX
 | 			// XXX
 | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ var DrawerClassPrototype = { | |||||||
| 	make: function(obj, client, options){ | 	make: function(obj, client, options){ | ||||||
| 		var that = this | 		var that = this | ||||||
| 		var overlay = $('<div>') | 		var overlay = $('<div>') | ||||||
| 			.addClass('drawer-widget') | 			.addClass('drawer-widget ' + (options.direction || 'bottom')) | ||||||
| 			.append($('<div>') | 			.append($('<div>') | ||||||
| 				.addClass('content') | 				.addClass('content') | ||||||
| 				.click(function(){ | 				.click(function(){ | ||||||
| @ -60,6 +60,8 @@ var DrawerPrototype = { | |||||||
| 		], | 		], | ||||||
| 
 | 
 | ||||||
| 		background: null, | 		background: null, | ||||||
|  | 
 | ||||||
|  | 		direction: 'bottom', | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	keyboard: { | 	keyboard: { | ||||||
| @ -115,30 +117,68 @@ var DrawerPrototype = { | |||||||
| 			.click(function(){ | 			.click(function(){ | ||||||
| 				that.close() | 				that.close() | ||||||
| 			}) | 			}) | ||||||
| 			.css({opacity: 0}) | 			.css({ opacity: 0 }) | ||||||
|  | 			.scrollTop(options.direction == 'bottom' ?  0 | ||||||
|  | 				: options.direction == 'top' ? | ||||||
|  | 					dom.find('.content')[0].scrollHeight | ||||||
|  | 				: 0) | ||||||
| 			.animate({ | 			.animate({ | ||||||
| 					scrollTop: Math.min( | 					scrollTop:  | ||||||
| 						client_dom.outerHeight(),  | 						(options.direction == 'bottom' ? | ||||||
| 						// do not scroll more than the container height and
 | 							Math.min( | ||||||
| 						// keep a bit on top...
 | 								client_dom.outerHeight(),  | ||||||
| 						(parent.is('body') ? $(document) : parent) | 								// do not scroll more than the container height and
 | ||||||
| 							.outerHeight()-options['fade-at'])+'px', | 								// keep a bit on top...
 | ||||||
|  | 								(parent.is('body') ? $(document) : parent) | ||||||
|  | 									.outerHeight()-options['fade-at']) + 'px' | ||||||
|  | 						// XXX this is wrong!
 | ||||||
|  | 						: options.direction == 'top' ? | ||||||
|  | 							(dom.find('.content')[0].scrollHeight | ||||||
|  | 							 	- dom.outerHeight() | ||||||
|  | 								+ options['fade-at']) + 'px' | ||||||
|  | 						: 0), | ||||||
| 					opacity: 1, | 					opacity: 1, | ||||||
| 				},  | 				},  | ||||||
| 				options['animate'], | 				options['animate'], | ||||||
| 				function(){ | 				function(){ | ||||||
| 					dom.scroll(function(){ | 					dom.scroll(function(){ | ||||||
| 						var st = $(this).scrollTop() | 						var st = $(this).scrollTop() | ||||||
| 						var h = Math.min(options['fade-at'], client_dom.outerHeight()) | 
 | ||||||
| 						// start fading...
 | 						// bottom drawer...
 | ||||||
| 						if(st < h){ | 						if(options.direction == 'bottom'){ | ||||||
| 							dom.css({ opacity: Math.min(1, st/h) }) | 							var h = Math.min(options['fade-at'], client_dom.outerHeight()) | ||||||
| 						} else if(dom.css('opacity') < 1){ | 
 | ||||||
| 							dom.css('opacity', 1) | 							// start fading...
 | ||||||
| 						} | 							if(st < h){ | ||||||
| 						// close drawer when scrolling to the top...
 | 								dom.css({ opacity: Math.min(1, st/h) }) | ||||||
| 						if(st < options['close-at']){ | 
 | ||||||
| 							that.close() | 							} else if(dom.css('opacity') < 1){ | ||||||
|  | 								dom.css('opacity', 1) | ||||||
|  | 							} | ||||||
|  | 
 | ||||||
|  | 							// close drawer when scrolling to the top...
 | ||||||
|  | 							if(st < options['close-at']){ | ||||||
|  | 								that.close() | ||||||
|  | 							} | ||||||
|  | 
 | ||||||
|  | 						// top drawer...
 | ||||||
|  | 						} else if(options.direction == 'top'){ | ||||||
|  | 							var h = dom.find('.content')[0].scrollHeight | ||||||
|  | 
 | ||||||
|  | 							// start fading...
 | ||||||
|  | 							// XXX not working yet...
 | ||||||
|  | 							if(st < h - options['fade-at']){ | ||||||
|  | 								dom.css({ opacity: Math.min(1, st/h) }) | ||||||
|  | 
 | ||||||
|  | 							} else if(dom.css('opacity') < 1){ | ||||||
|  | 								dom.css('opacity', 1) | ||||||
|  | 							} | ||||||
|  | 
 | ||||||
|  | 							// close...
 | ||||||
|  | 							if(st > h - options['close-at']){ | ||||||
|  | 								// XXX adapt close...
 | ||||||
|  | 								that.close() | ||||||
|  | 							} | ||||||
| 						} | 						} | ||||||
| 					}) | 					}) | ||||||
| 				}) | 				}) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user