mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-04 05:10:07 +00:00 
			
		
		
		
	some refactoring and bugfixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c1575f69c4
								
							
						
					
					
						commit
						cbc22e98ad
					
				@ -53,8 +53,8 @@ function getBookmarkedGIDBefore(gid){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*********************************************************************/
 | 
					/*********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function cropBookmarkedImages(cmp, keep_ribbons, no_cleanout_marks){
 | 
					function cropBookmarkedImages(cmp, keep_ribbons, keep_unloaded_gids){
 | 
				
			||||||
	cropDataTo(BOOKMARKS.slice(), keep_ribbons, no_cleanout_marks)
 | 
						cropDataTo(BOOKMARKS.slice(), keep_ribbons, keep_unloaded_gids)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return DATA
 | 
						return DATA
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -251,9 +251,7 @@ if(window.CEF_dumpJSON != null){
 | 
				
			|||||||
							// add the preview to the image object...
 | 
												// add the preview to the image object...
 | 
				
			||||||
							img.preview[size+'px'] = './' + CACHE_DIR +'/'+ preview_path.split(CACHE_DIR).pop()
 | 
												img.preview[size+'px'] = './' + CACHE_DIR +'/'+ preview_path.split(CACHE_DIR).pop()
 | 
				
			||||||
							// mark image dirty...
 | 
												// mark image dirty...
 | 
				
			||||||
							if(IMAGES_UPDATED.indexOf(gid) < 0){
 | 
												imageUpdated(gid)
 | 
				
			||||||
								IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
							}
 | 
					 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						//console.log('>>> Preview:', name, '('+size+'): Exists.')
 | 
											//console.log('>>> Preview:', name, '('+size+'): Exists.')
 | 
				
			||||||
						deferred.notify(gid, size, 'exists')
 | 
											deferred.notify(gid, size, 'exists')
 | 
				
			||||||
@ -324,9 +322,7 @@ if(window.CEF_dumpJSON != null){
 | 
				
			|||||||
								}
 | 
													}
 | 
				
			||||||
								img.preview[size+'px'] = './' + CACHE_DIR +'/'+ preview_path.split(CACHE_DIR).pop()
 | 
													img.preview[size+'px'] = './' + CACHE_DIR +'/'+ preview_path.split(CACHE_DIR).pop()
 | 
				
			||||||
								// mark image dirty...
 | 
													// mark image dirty...
 | 
				
			||||||
								if(IMAGES_UPDATED.indexOf(gid) < 0){
 | 
													imageUpdated(gid)
 | 
				
			||||||
									IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
								}
 | 
					 | 
				
			||||||
								// we are done...
 | 
													// we are done...
 | 
				
			||||||
								deferred.resolve()
 | 
													deferred.resolve()
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ui/data.js
									
									
									
									
									
								
							@ -695,6 +695,16 @@ function orientationExif2ImageGrid(orientation){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// mark an image as updated...
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					function imageUpdated(gid){
 | 
				
			||||||
 | 
						gid = gid == null ? getImageGID(): gid
 | 
				
			||||||
 | 
						if(IMAGES_UPDATED.indexOf(gid) == -1){
 | 
				
			||||||
 | 
							IMAGES_UPDATED.push(gid)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**********************************************************************
 | 
					/**********************************************************************
 | 
				
			||||||
* Constructors and general data manipulation
 | 
					* Constructors and general data manipulation
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								ui/files.js
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ui/files.js
									
									
									
									
									
								
							@ -753,9 +753,8 @@ function readImageOrientation(gid, no_update_loaded){
 | 
				
			|||||||
			img.flipped = o.flipped
 | 
								img.flipped = o.flipped
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// mark image dirty...
 | 
								// mark image dirty...
 | 
				
			||||||
			if((o_o != o.orientation || o_f != o.flipped ) 
 | 
								if(o_o != o.orientation || o_f != o.flipped){
 | 
				
			||||||
					&& IMAGES_UPDATED.indexOf(gid) < 0){
 | 
									imageUpdated(gid)
 | 
				
			||||||
				IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// update image if loaded...
 | 
								// update image if loaded...
 | 
				
			||||||
@ -811,7 +810,7 @@ function readImagesDates(images){
 | 
				
			|||||||
	return $.when.apply(null, $.map(images, function(_, gid){
 | 
						return $.when.apply(null, $.map(images, function(_, gid){
 | 
				
			||||||
		return readImageDate(gid, images)
 | 
							return readImageDate(gid, images)
 | 
				
			||||||
			.done(function(){
 | 
								.done(function(){
 | 
				
			||||||
				IMAGES_UPDATED.push(gid)
 | 
									imageUpdated(gid)
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
	}))
 | 
						}))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -823,7 +822,7 @@ function readImagesDatesQ(images){
 | 
				
			|||||||
	$.each(images, function(gid, img){
 | 
						$.each(images, function(gid, img){
 | 
				
			||||||
		queue.enqueue(readImageDate, gid, images)
 | 
							queue.enqueue(readImageDate, gid, images)
 | 
				
			||||||
			.always(function(){ 
 | 
								.always(function(){ 
 | 
				
			||||||
				IMAGES_UPDATED.push(gid)
 | 
									imageUpdated(gid)
 | 
				
			||||||
				queue.notify(gid, 'done') 
 | 
									queue.notify(gid, 'done') 
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
@ -844,7 +843,7 @@ function updateImageGID(gid, images, data){
 | 
				
			|||||||
			// images...
 | 
								// images...
 | 
				
			||||||
			images[gid] = images[key]
 | 
								images[gid] = images[key]
 | 
				
			||||||
			delete images[key]
 | 
								delete images[key]
 | 
				
			||||||
			IMAGES_UPDATED.push(gid)
 | 
								imageUpdated(gid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// data...
 | 
								// data...
 | 
				
			||||||
			if(data != null){
 | 
								if(data != null){
 | 
				
			||||||
 | 
				
			|||||||
@ -144,12 +144,11 @@ var updateSelectedImageMark = makeMarkUpdater(
 | 
				
			|||||||
// NOTE: MARKED may contain both gids that are not loaded and that do 
 | 
					// NOTE: MARKED may contain both gids that are not loaded and that do 
 | 
				
			||||||
// 		not exist, as there is no way to distinguish between the two 
 | 
					// 		not exist, as there is no way to distinguish between the two 
 | 
				
			||||||
// 		situations the cleanup is optional...
 | 
					// 		situations the cleanup is optional...
 | 
				
			||||||
function cropMarkedImages(cmp, keep_ribbons, no_cleanout_marks){
 | 
					function cropMarkedImages(cmp, keep_ribbons, keep_unloaded_gids){
 | 
				
			||||||
	cmp = cmp == null ? imageOrderCmp : cmp
 | 
						cmp = cmp == null ? imageOrderCmp : cmp
 | 
				
			||||||
	var cur = DATA.current
 | 
					 | 
				
			||||||
	var marked = MARKED.slice().sort(cmp)
 | 
						var marked = MARKED.slice().sort(cmp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cropDataTo(marked, keep_ribbons, no_cleanout_marks)
 | 
						cropDataTo(marked, keep_ribbons, keep_unloaded_gids)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return DATA
 | 
						return DATA
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								ui/setup.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ui/setup.js
									
									
									
									
									
								
							@ -290,9 +290,7 @@ function setupDataBindings(viewer){
 | 
				
			|||||||
				// change the image orientation status and add to 
 | 
									// change the image orientation status and add to 
 | 
				
			||||||
				// updated list...
 | 
									// updated list...
 | 
				
			||||||
				IMAGES[gid].orientation = orientation
 | 
									IMAGES[gid].orientation = orientation
 | 
				
			||||||
				if(IMAGES_UPDATED.indexOf(gid) == -1){
 | 
									imageUpdated(gid)
 | 
				
			||||||
					IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
		.on('flippingVertical flippingHorizontal', function(evt, image){
 | 
							.on('flippingVertical flippingHorizontal', function(evt, image){
 | 
				
			||||||
@ -302,9 +300,7 @@ function setupDataBindings(viewer){
 | 
				
			|||||||
				var flip = getImageFlipState(img)
 | 
									var flip = getImageFlipState(img)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				IMAGES[gid].flipped = flip
 | 
									IMAGES[gid].flipped = flip
 | 
				
			||||||
				if(IMAGES_UPDATED.indexOf(gid) == -1){
 | 
									imageUpdated(gid)
 | 
				
			||||||
					IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
		.on('resetToOriginalImage', function(evt, image){
 | 
							.on('resetToOriginalImage', function(evt, image){
 | 
				
			||||||
@ -315,9 +311,7 @@ function setupDataBindings(viewer){
 | 
				
			|||||||
				IMAGES[gid].flipped = null
 | 
									IMAGES[gid].flipped = null
 | 
				
			||||||
				IMAGES[gid].orientation = 0
 | 
									IMAGES[gid].orientation = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if(IMAGES_UPDATED.indexOf(gid) == -1){
 | 
									imageUpdated(gid)
 | 
				
			||||||
					IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										57
									
								
								ui/tags.js
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								ui/tags.js
									
									
									
									
									
								
							@ -10,9 +10,7 @@
 | 
				
			|||||||
// 		...
 | 
					// 		...
 | 
				
			||||||
// 	}
 | 
					// 	}
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
TAGS = {
 | 
					var TAGS = {}
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -72,8 +70,8 @@ function addTag(tags, gid, tagset, images){
 | 
				
			|||||||
			set = []
 | 
								set = []
 | 
				
			||||||
			tagset[tag] = set
 | 
								tagset[tag] = set
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(set.indexOf(tag) < 0){
 | 
							if(set.indexOf(gid) < 0){
 | 
				
			||||||
			set.push(tag)
 | 
								set.push(gid)
 | 
				
			||||||
			set.sort()
 | 
								set.sort()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,8 +82,7 @@ function addTag(tags, gid, tagset, images){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(updated){
 | 
						if(updated){
 | 
				
			||||||
		img.tags = img_tags
 | 
							img.tags = img_tags
 | 
				
			||||||
		// XXX hardcoded and not customizable...
 | 
							imageUpdated(gid)
 | 
				
			||||||
		IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -121,8 +118,7 @@ function removeTag(tags, gid, tagset, images){
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(updated){
 | 
						if(updated){
 | 
				
			||||||
		// XXX hardcoded and not customizable...
 | 
							imageUpdated(gid)
 | 
				
			||||||
		IMAGES_UPDATED.push(gid)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -203,6 +199,49 @@ function getRelatedTags(){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function tagMarked(tags){
 | 
				
			||||||
 | 
						MARKED.forEach(function(gid){
 | 
				
			||||||
 | 
							addTag(tags, gid)
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						return MARKED
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function untagMarked(tags){
 | 
				
			||||||
 | 
						MARKED.forEach(function(gid){
 | 
				
			||||||
 | 
							removeTag(tags, gid)
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						return MARKED
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function markTagged(tags){
 | 
				
			||||||
 | 
						MARKED = selectByTags(tags)
 | 
				
			||||||
 | 
						updateImages()
 | 
				
			||||||
 | 
						return MARKED
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function unmarkTagged(tags){
 | 
				
			||||||
 | 
						var set = selectByTags(tags)
 | 
				
			||||||
 | 
						set.forEach(function(gid){
 | 
				
			||||||
 | 
							var i = MARKED.indexOf(gid)
 | 
				
			||||||
 | 
							if(i > -1){
 | 
				
			||||||
 | 
								MARKED.splice(i, 1)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						updateImages()
 | 
				
			||||||
 | 
						return set
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function cropTagged(tags, cmp, keep_ribbons, keep_unloaded_gids){
 | 
				
			||||||
 | 
						cmp = cmp == null ? imageOrderCmp : cmp
 | 
				
			||||||
 | 
						var set = selectByTags(tags).sort(cmp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cropDataTo(set, keep_ribbons, keep_unloaded_gids)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return DATA
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**********************************************************************
 | 
					/**********************************************************************
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user