mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 10:50:08 +00:00
fixed a couple of bugs in taggs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7e184a90ce
commit
92de8870e6
38
ui/tags.js
38
ui/tags.js
@ -27,10 +27,10 @@ var TAGS_FILE_PATTERN = /^[0-9]*-tags.json$/
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
function buildTagsFromImages(tagset, images){
|
function buildTagsFromImages(images){
|
||||||
tagset = tagset == null ? TAGS : tagset
|
|
||||||
images = images == null ? IMAGES : images
|
images = images == null ? IMAGES : images
|
||||||
|
|
||||||
|
var tagset = {}
|
||||||
var order = DATA.order
|
var order = DATA.order
|
||||||
|
|
||||||
for(var gid in images){
|
for(var gid in images){
|
||||||
@ -59,6 +59,7 @@ function buildTagsFromImages(tagset, images){
|
|||||||
tagset[tag] = tagset[tag].filter(function(e){ return e != null })
|
tagset[tag] = tagset[tag].filter(function(e){ return e != null })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAGS = tagset
|
||||||
tagsUpdated()
|
tagsUpdated()
|
||||||
|
|
||||||
return tagset
|
return tagset
|
||||||
@ -139,12 +140,14 @@ function removeTag(tags, gid, tagset, images){
|
|||||||
var updated = false
|
var updated = false
|
||||||
var img = images[gid]
|
var img = images[gid]
|
||||||
|
|
||||||
// remove tags to tagset...
|
|
||||||
tags.map(function(tag){
|
tags.map(function(tag){
|
||||||
var set = tagset[tag]
|
var set = tagset[tag]
|
||||||
if(set != null && set.indexOf(tag) >= 0){
|
// remove tags from tagset...
|
||||||
|
if(set != null && set.indexOf(gid) >= 0){
|
||||||
|
updated = true
|
||||||
set.splice(set.indexOf(tag), 1)
|
set.splice(set.indexOf(tag), 1)
|
||||||
}
|
}
|
||||||
|
// remove tags from image...
|
||||||
if(img.tags != null && img.tags.indexOf(tag) >= 0){
|
if(img.tags != null && img.tags.indexOf(tag) >= 0){
|
||||||
updated = true
|
updated = true
|
||||||
img.tags.splice(img.tags.indexOf(tag), 1)
|
img.tags.splice(img.tags.indexOf(tag), 1)
|
||||||
@ -335,9 +338,9 @@ function untagMarked(tags){ return untagList(MARKED, tags) }
|
|||||||
function tagOnlyMarked(tags){ return tagOnlyList(MARKED, tags) }
|
function tagOnlyMarked(tags){ return tagOnlyList(MARKED, tags) }
|
||||||
|
|
||||||
// tag manipulation of bookmarked images...
|
// tag manipulation of bookmarked images...
|
||||||
function tagBookmarked(tags){ return tagList(BOOKMARKED, tags) }
|
function tagBookmarked(tags){ return tagList(BOOKMARKS, tags) }
|
||||||
function untagBookmarked(tags){ return untagList(BOOKMARKED, tags) }
|
function untagBookmarked(tags){ return untagList(BOOKMARKS, tags) }
|
||||||
function tagOnlyBookmarked(tags){ return tagOnlyList(BOOKMARKED, tags) }
|
function tagOnlyBookmarked(tags){ return tagOnlyList(BOOKMARKS, tags) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -504,27 +507,6 @@ function tagsUpdated(){
|
|||||||
* Setup...
|
* Setup...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function setupTags(viewer){
|
|
||||||
console.log('Tags: setup...')
|
|
||||||
|
|
||||||
return viewer
|
|
||||||
.on('imagesLoaded', function(){
|
|
||||||
// XXX need to detect if tags have been loaded...
|
|
||||||
TAGS = {}
|
|
||||||
|
|
||||||
showStatusQ('Tags: Index: building...')
|
|
||||||
|
|
||||||
// XXX should this be sync???
|
|
||||||
var t0 = Date.now()
|
|
||||||
buildTagsFromImages()
|
|
||||||
var t1 = Date.now()
|
|
||||||
|
|
||||||
showStatusQ('Tags: Index: done ('+( t1 - t0 )+'ms).')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//SETUP_BINDINGS.push(setupTags)
|
|
||||||
|
|
||||||
|
|
||||||
// Setup the unsorted image state managers...
|
// Setup the unsorted image state managers...
|
||||||
//
|
//
|
||||||
// Unsorted tags are removed by shifting or by aligning, but only in
|
// Unsorted tags are removed by shifting or by aligning, but only in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user