mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	alignDataToRibbon(...) working, needs more testing + identified a class of buggs (see TODO.otl)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									21ac274a19
								
							
						
					
					
						commit
						d75741205a
					
				| @ -95,6 +95,8 @@ Roadmap | |||||||
| 
 | 
 | ||||||
| [_] 29% Gen 3 current todo | [_] 29% Gen 3 current todo | ||||||
| 	[_] 59% High priority | 	[_] 59% High priority | ||||||
|  | 		[_] BUG CLASS: everything should work with empty ribbons... | ||||||
|  | 		| currently some code breaks when seeing an empty ribbon... | ||||||
| 		[_] add indicator to ribbon up/down navigation in full screen... | 		[_] add indicator to ribbon up/down navigation in full screen... | ||||||
| 		| this might be a number or some kind of animation... | 		| this might be a number or some kind of animation... | ||||||
| 		[_] BUG: sometimes opening a dir (open dialog) does not do anything... | 		[_] BUG: sometimes opening a dir (open dialog) does not do anything... | ||||||
|  | |||||||
							
								
								
									
										21
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								ui/data.js
									
									
									
									
									
								
							| @ -590,9 +590,12 @@ function getImageGIDs(from, count, ribbon, inclusive){ | |||||||
| 			}  | 			}  | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| 	// XXX check if this is empty...
 |  | ||||||
| 	ribbon = DATA.ribbons[ribbon] | 	ribbon = DATA.ribbons[ribbon] | ||||||
| 
 | 
 | ||||||
|  | 	// ribbon this is empty...
 | ||||||
|  | 	if(ribbon.length == 0){ | ||||||
|  | 		return [] | ||||||
|  | 	} | ||||||
| 	if(count > 0){ | 	if(count > 0){ | ||||||
| 		var c = inclusive == null ? 1 : 0 | 		var c = inclusive == null ? 1 : 0 | ||||||
| 		var start = ribbon.indexOf(from) + c | 		var start = ribbon.indexOf(from) + c | ||||||
| @ -850,7 +853,12 @@ function splitData(data, gid1){ | |||||||
| 		// XXX revise...
 | 		// XXX revise...
 | ||||||
| 		for(var j=0; j<gids.length; j++){ | 		for(var j=0; j<gids.length; j++){ | ||||||
| 			var prev = cur | 			var prev = cur | ||||||
| 			var cur = r.indexOf(getGIDBefore(gids[j], i, null, data)) + 1 | 			var gid = getGIDBefore(gids[j], i, null, data) | ||||||
|  | 			if(gid == gids[j]){ | ||||||
|  | 				var cur = r.indexOf(gid) | ||||||
|  | 			} else { | ||||||
|  | 				var cur = r.indexOf(gid) + 1 | ||||||
|  | 			} | ||||||
| 
 | 
 | ||||||
| 			// split and save the section to the corresponding data object...
 | 			// split and save the section to the corresponding data object...
 | ||||||
| 			res[j].ribbons.push(r.slice(prev, cur)) | 			res[j].ribbons.push(r.slice(prev, cur)) | ||||||
| @ -915,6 +923,15 @@ function alignDataToRibbon(ribbon, data){ | |||||||
| 	 | 	 | ||||||
| 	var res = mergeData.apply(null, sections) | 	var res = mergeData.apply(null, sections) | ||||||
| 	res.current = data.current | 	res.current = data.current | ||||||
|  | 
 | ||||||
|  | 	// clean out empty ribbons from head and tail...
 | ||||||
|  | 	while(res.ribbons[0].length == 0){ | ||||||
|  | 		res.ribbons.splice(0, 1) | ||||||
|  | 	} | ||||||
|  | 	while(res.ribbons[res.ribbons.length-1].length == 0){ | ||||||
|  | 		res.ribbons.pop() | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user