mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 19:30:07 +00:00 
			
		
		
		
	added marked image list, now persistent over dynamically loaded data...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									8b34dfed42
								
							
						
					
					
						commit
						9c2ceb95ae
					
				
							
								
								
									
										19
									
								
								ui/base.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								ui/base.js
									
									
									
									
									
								
							| @ -59,6 +59,20 @@ function getRibbon(image){ | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| function getImage(gid){ | ||||
| 	if(e == null){ | ||||
| 		return $('.current.image') | ||||
| 	} | ||||
| 	// XXX do a proper check...
 | ||||
| 	// gid...
 | ||||
| 	return $('.image[gid='+ JSON.stringify(gid) +']') | ||||
| 	 | ||||
| 	// order...
 | ||||
| 	// XXX
 | ||||
| 	//return $('.image[order='+ JSON.stringify(gid) +']')
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // NOTE: elem is optional and if given can be an image or a ribbon...
 | ||||
| function getRibbonIndex(elem){ | ||||
| 	if(elem == null){ | ||||
| @ -844,7 +858,10 @@ function shiftImageDownNewRibbon(image, moving){ | ||||
| 
 | ||||
| // XXX if this unmarks an image in marked-only mode no visible image is 
 | ||||
| // 		going to be current...
 | ||||
| var toggleImageMark = createCSSClassToggler('.current.image', 'marked') | ||||
| var toggleImageMark = createCSSClassToggler('.current.image', 'marked', | ||||
| 	function(action){ | ||||
| 		$('.viewer').trigger('togglingMark', [$('.current.image'), action]) | ||||
| 	}) | ||||
| 
 | ||||
| 
 | ||||
| // mode can be:
 | ||||
|  | ||||
							
								
								
									
										30
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								ui/data.js
									
									
									
									
									
								
							| @ -41,6 +41,8 @@ var DATA = { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| var MARKS = [] | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /********************************************************************** | ||||
| @ -228,11 +230,16 @@ function updateImage(image, gid, size){ | ||||
| 	// update classes and other indicators...
 | ||||
| 	image | ||||
| 		.attr({ | ||||
| 			//order: JSON.stringify(DATA.order.indexOf(gid)),
 | ||||
| 			order: JSON.stringify(gid)  | ||||
| 			// XXX update other attrs... 
 | ||||
| 		}) | ||||
| 
 | ||||
| 	// setup marks...
 | ||||
| 	if(MARKS.indexOf(gid) != -1){ | ||||
| 		image.addClass('marked') | ||||
| 	} else { | ||||
| 		image.removeClass('marked') | ||||
| 	} | ||||
| 
 | ||||
| 	// XXX STUB
 | ||||
| 	image.text(gid) | ||||
| 
 | ||||
| @ -257,11 +264,6 @@ function updateImage(image, gid, size){ | ||||
| 	image.css({ | ||||
| 		'background-image': url, | ||||
| 	}) | ||||
| 
 | ||||
| 	 | ||||
| 	// XXX STUB
 | ||||
| 	//image.text(image.text() + ' ('+ s +'px)')
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -537,6 +539,20 @@ function setupDataBindings(viewer){ | ||||
| 		.on('focusingImage', function(evt, image){ | ||||
| 			DATA.current = getImageGID($(image)) | ||||
| 		}) | ||||
| 
 | ||||
| 
 | ||||
| 		.on('togglingMark', function(evt, img, action){ | ||||
| 			var gid = getImageGID(img)  | ||||
| 
 | ||||
| 			// add marked image to list...
 | ||||
| 			if(action == 'on'){ | ||||
| 				MARKS.push(gid) | ||||
| 
 | ||||
| 			// remove marked image from list...
 | ||||
| 			} else { | ||||
| 				MARKS.splice(MARKS.indexOf(gid), 1) | ||||
| 			} | ||||
| 		}) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -260,7 +260,6 @@ $(function(){ | ||||
| 	centerView(focusImage($('.image').first()), 'css') | ||||
| 	updateImages() | ||||
| 
 | ||||
| 
 | ||||
| }) | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										8
									
								
								ui/ui.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								ui/ui.js
									
									
									
									
									
								
							| @ -1,3 +1,11 @@ | ||||
| /********************************************************************** | ||||
| *  | ||||
| * | ||||
| * | ||||
| **********************************************************************/ | ||||
| 
 | ||||
| //var DEBUG = DEBUG != null ? DEBUG : true
 | ||||
| 
 | ||||
| /*********************************************************************/ | ||||
| 
 | ||||
| /*********************************************************************/ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user