seem to have ironed out most of the issues, still in testing mode...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-12-06 02:44:46 +03:00
parent 3eecbd6484
commit 0a8af5628a
3 changed files with 14 additions and 6 deletions

View File

@ -1982,7 +1982,9 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
// load local_tags...
local_tag_names
.forEach(function(tag){
tags[tag] = new Set(local_tags[tag] || [])
tags[tag] = new Set(local_tags[tag]
|| (that.data.tags.__index || {})[tag]
|| [])
})
;(this.crop_stack || [])
@ -2109,13 +2111,14 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
}
var t = (c.data || {}).tags || {}
/* XXX do we need this???
c.local_tags = c.local_tags || {}
;(that.config['collection-local-tags'] || [])
.forEach(function(tag){
c.local_tags[tag] = new Set(c.local_tags[tag] || t[tag] || []) })
//*/
})
}],
//*/
],
})

View File

@ -3399,6 +3399,8 @@ var DataWithTags2Prototype = {
},
join: function(...others){
var res = DataWithTags2Prototype.__proto__.join.apply(this, arguments)
!(others[0] instanceof Data)
&& others.shift()
res.tags.join(...others
.map(function(other){
return other.tags }))

View File

@ -445,7 +445,7 @@ var TagsPrototype = {
return false
},
has: function(value){
for(var v of Object.values(this.__index)){
for(var v of Object.values(this.__index || {})){
if(v.has(value)){
return true
}
@ -754,19 +754,22 @@ var TagsPrototype = {
join: function(...others){
var that = this
var index = this.__index
var index = this.__index || {}
others
.forEach(function(other){
Object.entries(other.__index)
Object.entries(other.__index || {})
.forEach(function(e){
index[e[0]] = new Set([...(index[e[0]] || []), ...e[1]]) }) })
Object.keys(index).length > 0
&& this.__index == null
&& (this.__index = index)
return this
},
// XXX create a new tagset with only the given values...
// XXX this should support a function...
filter: function(values){
var res = this.clone()
Object.values(res.__index)
Object.values(res.__index || {})
.forEach(function(s){
values.forEach(function(v){ s.delete(v) }) })
return res