mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
fixed a bug in getLoadedGIDs(..), now it will sort the results...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
be0a5bc2d4
commit
a76753eaa5
12
ui/crop.js
12
ui/crop.js
@ -277,6 +277,12 @@ function filterImagesDialog(){
|
|||||||
updateStatus('Filter...').show()
|
updateStatus('Filter...').show()
|
||||||
|
|
||||||
cfg = {}
|
cfg = {}
|
||||||
|
cfg['GID |'
|
||||||
|
+'Use gid or gid tail part to find an\n'
|
||||||
|
+'image.\n'
|
||||||
|
+'\n'
|
||||||
|
+'NOTE: use of at least 6 characters is\n'
|
||||||
|
+'recommended.'] = ''
|
||||||
cfg['sep0'] = '---'
|
cfg['sep0'] = '---'
|
||||||
cfg['Name'] = ''
|
cfg['Name'] = ''
|
||||||
cfg['Path |'
|
cfg['Path |'
|
||||||
@ -345,7 +351,11 @@ function filterImagesDialog(){
|
|||||||
var filter = {}
|
var filter = {}
|
||||||
// build the filter...
|
// build the filter...
|
||||||
for(var field in res){
|
for(var field in res){
|
||||||
if(/^Name/.test(field) && res[field].trim() != ''){
|
// this will search for gid or gid part at the end of a gid...
|
||||||
|
if(/^GID/.test(field) && res[field].trim() != ''){
|
||||||
|
filter['id'] = res[field] + '$'
|
||||||
|
|
||||||
|
} else if(/^Name/.test(field) && res[field].trim() != ''){
|
||||||
filter['name'] = res[field]
|
filter['name'] = res[field]
|
||||||
|
|
||||||
} else if(/^Path/.test(field) && res[field].trim() != ''){
|
} else if(/^Path/.test(field) && res[field].trim() != ''){
|
||||||
|
|||||||
15
ui/data.js
15
ui/data.js
@ -536,9 +536,6 @@ function linSearch(target, lst, check, return_position, get){
|
|||||||
// no hit...
|
// no hit...
|
||||||
return return_position ? -1 : null
|
return return_position ? -1 : null
|
||||||
}
|
}
|
||||||
Array.prototype.linSearch = function(target, cmp, get){
|
|
||||||
return linSearch(target, this, cmp, true, get)
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -575,11 +572,6 @@ function binSearch(target, lst, check, return_position, get){
|
|||||||
// no result...
|
// no result...
|
||||||
return return_position ? -1 : null
|
return return_position ? -1 : null
|
||||||
}
|
}
|
||||||
/* XXX do we actually need to patch Array???
|
|
||||||
Array.prototype.binSearch = function(target, cmp, get){
|
|
||||||
return binSearch(target, this, cmp, true, get)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// This is a cheating fast sort...
|
// This is a cheating fast sort...
|
||||||
@ -800,7 +792,9 @@ function getAllGids(data){
|
|||||||
// Get all the currently loaded gids...
|
// Get all the currently loaded gids...
|
||||||
//
|
//
|
||||||
// NOTE: this will return an unsorted list of gids...
|
// NOTE: this will return an unsorted list of gids...
|
||||||
function getLoadedGIDs(gids, data){
|
// NOTE: this will sort the result unless either no_sort is true or gids
|
||||||
|
// is not given...
|
||||||
|
function getLoadedGIDs(gids, data, no_sort){
|
||||||
data = data == null ? DATA : data
|
data = data == null ? DATA : data
|
||||||
var res = []
|
var res = []
|
||||||
data.ribbons.forEach(function(r){
|
data.ribbons.forEach(function(r){
|
||||||
@ -811,6 +805,9 @@ function getLoadedGIDs(gids, data){
|
|||||||
return res.indexOf(e) >= 0
|
return res.indexOf(e) >= 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if(!no_sort){
|
||||||
|
res = fastSortGIDsByOrder(res)
|
||||||
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -236,6 +236,11 @@ function makeMarkUpdater(img_class, mark_class, test){
|
|||||||
|
|
||||||
|
|
||||||
// NOTE: this supports only shifts by one position...
|
// NOTE: this supports only shifts by one position...
|
||||||
|
// XXX this is similar to insertGIDToPosition(..) do we need both?
|
||||||
|
// ...this one is a special case and insertGIDToPosition(..) is
|
||||||
|
// general, the later uses search to find the position, here we
|
||||||
|
// know the aproximate location, the question is if this speedup
|
||||||
|
// is worth the effort of maintaining a special case function...
|
||||||
function shiftGIDToOrderInList(gid, direction, list){
|
function shiftGIDToOrderInList(gid, direction, list){
|
||||||
var gid_o = DATA.order.indexOf(gid)
|
var gid_o = DATA.order.indexOf(gid)
|
||||||
var gid_m = list.indexOf(gid)
|
var gid_m = list.indexOf(gid)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user