mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	edded export index preview limit + now crop is dropped on .load(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									de6ead22a8
								
							
						
					
					
						commit
						daa462184b
					
				| @ -691,6 +691,9 @@ module.CropActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	// load the crop stack if present...
 | 	// load the crop stack if present...
 | ||||||
| 	load: [function(data){ | 	load: [function(data){ | ||||||
|  | 		// clear previous crop state...
 | ||||||
|  | 		delete this.crop_stack | ||||||
|  | 
 | ||||||
| 		if(data.crop_stack){ | 		if(data.crop_stack){ | ||||||
| 			this.crop_stack = data.crop_stack.map(function(j){ | 			this.crop_stack = data.crop_stack.map(function(j){ | ||||||
| 				return data.Data(j) | 				return data.Data(j) | ||||||
| @ -727,8 +730,7 @@ module.CropActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	// true if current viewer is cropped...
 | 	// true if current viewer is cropped...
 | ||||||
| 	get cropped(){ | 	get cropped(){ | ||||||
| 		return this.crop_stack != null | 		return this.crop_stack != null }, | ||||||
| 	}, |  | ||||||
| 
 | 
 | ||||||
| 	// crop...
 | 	// crop...
 | ||||||
| 	//
 | 	//
 | ||||||
|  | |||||||
| @ -1214,6 +1214,14 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 			'1920', | 			'1920', | ||||||
| 		], | 		], | ||||||
| 		'export-preview-size': 1000, | 		'export-preview-size': 1000, | ||||||
|  | 
 | ||||||
|  | 		'export-preview-size-limits': [ | ||||||
|  | 			'900', | ||||||
|  | 			'1000', | ||||||
|  | 			'1280', | ||||||
|  | 			'1920', | ||||||
|  | 		], | ||||||
|  | 		'export-preview-size-limit': 'no limit', | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// This can be:
 | 	// This can be:
 | ||||||
| @ -1484,8 +1492,8 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 		function(path, max_size, include_orig, logger){ | 		function(path, max_size, include_orig, logger){ | ||||||
| 			logger = logger || this.logger | 			logger = logger || this.logger | ||||||
| 
 | 
 | ||||||
| 			// XXX if size is not given save all sizes...
 | 			max_size = parseInt(max_size || this.config['export-preview-size-limit']) || null | ||||||
| 			//max_size = max_size || this.config['export-preview-size']
 | 			// XXX make this dependant on max_size....
 | ||||||
| 			include_orig = include_orig || true | 			include_orig = include_orig || true | ||||||
| 
 | 
 | ||||||
| 			// XXX is this correct???
 | 			// XXX is this correct???
 | ||||||
| @ -1546,8 +1554,19 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 				if(previews || img.path){ | 				if(previews || img.path){ | ||||||
| 					Object.keys(previews || {}) | 					Object.keys(previews || {}) | ||||||
| 						// limit preview size...
 | 						// limit preview size...
 | ||||||
|  | 						// NOTE: also remove the preview resolution if 
 | ||||||
|  | 						// 		it's smaller...
 | ||||||
| 						.filter(function(res){  | 						.filter(function(res){  | ||||||
| 							return !max_size || parseInt(res) <= max_size}) | 							// no size limit or match...
 | ||||||
|  | 							if(!max_size || parseInt(res) <= max_size){ | ||||||
|  | 								return true | ||||||
|  | 
 | ||||||
|  | 							// skip and remove...
 | ||||||
|  | 							} else { | ||||||
|  | 								delete previews[res] | ||||||
|  | 								return false | ||||||
|  | 							} | ||||||
|  | 						}) | ||||||
| 						// get paths...
 | 						// get paths...
 | ||||||
| 						.map(function(res){ return decodeURI(previews[res]) }) | 						.map(function(res){ return decodeURI(previews[res]) }) | ||||||
| 						// XXX might be a good idea to include include 
 | 						// XXX might be a good idea to include include 
 | ||||||
| @ -1585,11 +1604,15 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 				} | 				} | ||||||
| 			}) | 			}) | ||||||
| 
 | 
 | ||||||
|  | 			// prep the index...
 | ||||||
|  | 			var index = this.prepareIndexForWrite(json, true) | ||||||
|  | 
 | ||||||
| 			// NOTE: if we are to use .saveIndex(..) here, do not forget
 | 			// NOTE: if we are to use .saveIndex(..) here, do not forget
 | ||||||
| 			// 		to reset .changes
 | 			// 		to reset .changes
 | ||||||
| 			queue.push(file.writeIndex( | 			queue.push(file.writeIndex( | ||||||
| 					this.prepareIndexForWrite(json, true).prepared,  | 					index.prepared, | ||||||
| 					index_path,  | 					index_path,  | ||||||
|  | 					index.date, | ||||||
| 					this.config['index-filename-template'],  | 					this.config['index-filename-template'],  | ||||||
| 					logger || this.logger) | 					logger || this.logger) | ||||||
| 				// set hidden file attribute on Windows...
 | 				// set hidden file attribute on Windows...
 | ||||||
| @ -1597,7 +1620,6 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 					typeof(process) != 'undefined'  | 					typeof(process) != 'undefined'  | ||||||
| 						&& (process.platform == 'win32'  | 						&& (process.platform == 'win32'  | ||||||
| 							|| process.platform == 'win64') | 							|| process.platform == 'win64') | ||||||
| 						// XXX do we need to quote path???
 |  | ||||||
| 						&& child_process | 						&& child_process | ||||||
| 							.spawn('attrib', ['+h', index_path]) | 							.spawn('attrib', ['+h', index_path]) | ||||||
| 				})) | 				})) | ||||||
| @ -1874,7 +1896,7 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 					// XXX use closest preview instead of hi-res when 
 | 					// XXX use closest preview instead of hi-res when 
 | ||||||
| 					// 		this is set...
 | 					// 		this is set...
 | ||||||
| 					// XXX need to add option to save full index...
 | 					// XXX need to add option to save full index...
 | ||||||
| 					//'size_limit',
 | 					'size_limit', | ||||||
| 					// XXX might be a good idea to include source data links
 | 					// XXX might be a good idea to include source data links
 | ||||||
| 					//'include_source_url', // bool
 | 					//'include_source_url', // bool
 | ||||||
| 					'comment', | 					'comment', | ||||||
| @ -1983,6 +2005,25 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 						})) | 						})) | ||||||
| 
 | 
 | ||||||
| 		}, | 		}, | ||||||
|  | 		'size_limit': function(actions, make, parent){ | ||||||
|  | 			return make(['Limit image size: ',  | ||||||
|  | 					function(){  | ||||||
|  | 						return actions.config['export-preview-size-limit'] || 'no limit' }], | ||||||
|  | 					{ buttons: [ | ||||||
|  | 						['×', function(p){ | ||||||
|  | 							actions.config['export-preview-size-limit'] = 'no limit' | ||||||
|  | 							parent.update() | ||||||
|  | 						}], | ||||||
|  | 					] }) | ||||||
|  | 				// XXX add validation???
 | ||||||
|  | 				.on('open',  | ||||||
|  | 					widgets.makeNestedConfigListEditor(actions, parent, | ||||||
|  | 						'export-preview-size-limits', | ||||||
|  | 						'export-preview-size-limit', | ||||||
|  | 						{ | ||||||
|  | 							sort: function(a, b){ return parseInt(a) - parseInt(b) }, | ||||||
|  | 						})) | ||||||
|  | 		}, | ||||||
| 		// XXX BUG: history closing errors -- non-critical...
 | 		// XXX BUG: history closing errors -- non-critical...
 | ||||||
| 		'target_dir': function(actions, make, parent){ | 		'target_dir': function(actions, make, parent){ | ||||||
| 			var elem = make(['To: ',  | 			var elem = make(['To: ',  | ||||||
|  | |||||||
| @ -335,7 +335,8 @@ module.makeUIContainer = function(make){ | |||||||
| 				// Compensate for click focusing the parent dialog when
 | 				// Compensate for click focusing the parent dialog when
 | ||||||
| 				// a child is created...
 | 				// a child is created...
 | ||||||
| 				// XXX is this the right way to go???
 | 				// XXX is this the right way to go???
 | ||||||
| 				.on('click', function(evt){ that.modal.focus() }) | 				.on('click', function(evt){  | ||||||
|  | 					that.modal && that.modal.focus() }) | ||||||
| 
 | 
 | ||||||
| 		return o | 		return o | ||||||
| 	}) | 	}) | ||||||
|  | |||||||
| @ -18,7 +18,6 @@ if(typeof(process) != 'undefined'){ | |||||||
| 
 | 
 | ||||||
| 	var guaranteeEvents = requirejs('guarantee-events') | 	var guaranteeEvents = requirejs('guarantee-events') | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| } else { | } else { | ||||||
| 	return module | 	return module | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user