mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	working on scroll offset...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c9de5e4b72
								
							
						
					
					
						commit
						cffc892aff
					
				| @ -3693,9 +3693,11 @@ var BaseBrowserPrototype = { | |||||||
| 
 | 
 | ||||||
| 				full  | 				full  | ||||||
| 					&& this.make(opts)  | 					&& this.make(opts)  | ||||||
|  | 				var context = {} | ||||||
| 				this | 				this | ||||||
| 					.preRender() | 					// XXX this needs access to render context....
 | ||||||
| 					.render(opts)  | 					.preRender(opts, (opts || {}).renderer, context) | ||||||
|  | 					.render(opts, (opts || {}).renderer, context)  | ||||||
| 				this.trigger(...args) }.bind(this) | 				this.trigger(...args) }.bind(this) | ||||||
| 			var _update_n_delay = function(){ | 			var _update_n_delay = function(){ | ||||||
| 				// call...
 | 				// call...
 | ||||||
| @ -4327,13 +4329,17 @@ var HTMLBrowserPrototype = { | |||||||
| 
 | 
 | ||||||
| 	// page-relative items...
 | 	// page-relative items...
 | ||||||
| 	get pagetop(){ | 	get pagetop(){ | ||||||
| 		return this.get('pagetop') }, | 		return this.dom  | ||||||
|  | 			&& this.get('pagetop') }, | ||||||
| 	set pagetop(item){ | 	set pagetop(item){ | ||||||
| 		this.scrollTo(item, 'start') }, | 		this.dom  | ||||||
|  | 			&& this.scrollTo(item, 'start') }, | ||||||
| 	get pagebottom(){ | 	get pagebottom(){ | ||||||
| 		return this.get('pagebottom') }, | 		return this.dom | ||||||
|  | 			&& this.get('pagebottom') }, | ||||||
| 	set pagebottom(item){ | 	set pagebottom(item){ | ||||||
| 		this.scrollTo(item, 'end') }, | 		this.dom | ||||||
|  | 			&& this.scrollTo(item, 'end') }, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	// Extending query...
 | 	// Extending query...
 | ||||||
| @ -4493,6 +4499,7 @@ var HTMLBrowserPrototype = { | |||||||
| 	// 		</div>
 | 	// 		</div>
 | ||||||
| 	// 	or same as .renderList(..)
 | 	// 	or same as .renderList(..)
 | ||||||
| 	//
 | 	//
 | ||||||
|  | 	// XXX set scroll offset...
 | ||||||
| 	renderFinalize: function(header, items, footer, context){ | 	renderFinalize: function(header, items, footer, context){ | ||||||
| 		var that = this | 		var that = this | ||||||
| 		var d = this.renderList(header, items, footer, context) | 		var d = this.renderList(header, items, footer, context) | ||||||
| @ -4528,9 +4535,16 @@ var HTMLBrowserPrototype = { | |||||||
| 					&& that.focused.elem.focus() }) | 					&& that.focused.elem.focus() }) | ||||||
| 		//*/
 | 		//*/
 | ||||||
| 		 | 		 | ||||||
|  | 		// XXX get the scroll offset...
 | ||||||
|  | 		// XXX
 | ||||||
|  | 		console.log('SCROLL OFFSET:', context.scroll_offset) | ||||||
|  | 
 | ||||||
| 		// XXX should this be done here or in .render(..)???
 | 		// XXX should this be done here or in .render(..)???
 | ||||||
| 		this.dom = d | 		this.dom = d | ||||||
| 
 | 
 | ||||||
|  | 		// set the scroll offset...
 | ||||||
|  | 		// XXX
 | ||||||
|  | 
 | ||||||
| 		// keep focus where it is...
 | 		// keep focus where it is...
 | ||||||
| 		var focused = this.focused | 		var focused = this.focused | ||||||
| 		focused | 		focused | ||||||
| @ -5011,8 +5025,17 @@ var HTMLBrowserPrototype = { | |||||||
| 	// NOTE: this will also kill any user-set keys for disabled/hidden items...
 | 	// NOTE: this will also kill any user-set keys for disabled/hidden items...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// XXX also handle global button keys...
 | 	// XXX also handle global button keys...
 | ||||||
| 	__preRender__: function(){ | 	__preRender__: function(evt, options, renderer, context){ | ||||||
| 		var that = this | 		var that = this | ||||||
|  | 
 | ||||||
|  | 		// prepare for maintaining the scroll position...
 | ||||||
|  | 		var ref = context.scroll_reference = this.focused || this.pagetop | ||||||
|  | 		context.scroll_offset =  | ||||||
|  | 			context.scroll_offset | ||||||
|  | 			|| (ref && ref.dom && ref.dom.offsetTop) ? | ||||||
|  | 				ref.dom.offsetTop - ref.dom.offsetParent.scrollTop | ||||||
|  | 				: null | ||||||
|  | 
 | ||||||
| 		// reset item shortcuts...
 | 		// reset item shortcuts...
 | ||||||
| 		var shortcuts =  | 		var shortcuts =  | ||||||
| 			this.keybindings.ItemShortcuts =  | 			this.keybindings.ItemShortcuts =  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user