mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ea842217ab
commit
b31bf29321
@ -219,6 +219,9 @@
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
.browse-widget .list .button.blank {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
.browse-widget .list .item {
|
.browse-widget .list .item {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
|
|||||||
@ -159,10 +159,10 @@ var CollectionActions = actions.Actions({
|
|||||||
|
|
||||||
this.__collection_order.splice(0, this.__collection_order.length, ...res)
|
this.__collection_order.splice(0, this.__collection_order.length, ...res)
|
||||||
|
|
||||||
return this.__collection_order
|
return this.__collection_order.slice()
|
||||||
},
|
},
|
||||||
set collection_order(value){
|
set collection_order(value){
|
||||||
this.__collection_order = value },
|
value && this.sortCollections(value) },
|
||||||
|
|
||||||
get collections_length(){
|
get collections_length(){
|
||||||
var c = (this.collections || {})
|
var c = (this.collections || {})
|
||||||
@ -658,6 +658,23 @@ var CollectionActions = actions.Actions({
|
|||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
|
// Collections...
|
||||||
|
//
|
||||||
|
sortCollections: ['- Collections/',
|
||||||
|
function(cmp){
|
||||||
|
if(cmp instanceof Array){
|
||||||
|
this.__collection_order = cmp.slice()
|
||||||
|
|
||||||
|
} else if(cmp instanceof Function){
|
||||||
|
this.__collection_order.sort(cmp)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.__collection_order.sort()
|
||||||
|
}
|
||||||
|
this.collection_order
|
||||||
|
}],
|
||||||
|
|
||||||
|
|
||||||
// Introspection...
|
// Introspection...
|
||||||
//
|
//
|
||||||
inCollections: ['- Image/',
|
inCollections: ['- Image/',
|
||||||
@ -905,6 +922,11 @@ var CollectionActions = actions.Actions({
|
|||||||
state.data = d
|
state.data = d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// image count...
|
||||||
|
if(c[title].count){
|
||||||
|
state.count = c[title].count
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: this can be done lazily when loading each collection
|
// NOTE: this can be done lazily when loading each collection
|
||||||
// but doing so will make the system more complex and
|
// but doing so will make the system more complex and
|
||||||
// confuse (or complicate) some code that expects
|
// confuse (or complicate) some code that expects
|
||||||
@ -996,6 +1018,7 @@ var CollectionActions = actions.Actions({
|
|||||||
: state.data)
|
: state.data)
|
||||||
if(data){
|
if(data){
|
||||||
s.data = data.dumpJSON()
|
s.data = data.dumpJSON()
|
||||||
|
s.count = data.length
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle .crop_stack of collection...
|
// handle .crop_stack of collection...
|
||||||
@ -1127,7 +1150,7 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
// .markChanged('collection: '+JSON.stringify(<gid>), [<tag>, ..])
|
// .markChanged('collection: '+JSON.stringify(<gid>), [<tag>, ..])
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// collection list...
|
// collection add/remove...
|
||||||
[[
|
[[
|
||||||
'collectionCreated',
|
'collectionCreated',
|
||||||
'collectionRemoved',
|
'collectionRemoved',
|
||||||
@ -1141,6 +1164,17 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
'collection: '
|
'collection: '
|
||||||
+JSON.stringify(this.collections[collection].gid || collection))
|
+JSON.stringify(this.collections[collection].gid || collection))
|
||||||
}],
|
}],
|
||||||
|
// collection sort...
|
||||||
|
['sortCollections.pre',
|
||||||
|
function(){
|
||||||
|
var o = (this.collection_order || []).slice()
|
||||||
|
|
||||||
|
return function(){
|
||||||
|
;(this.collection_order || [])
|
||||||
|
.filter(function(e, i){ return e != o[i] }).length > 0
|
||||||
|
&& this.markChanged('collections')
|
||||||
|
}
|
||||||
|
}],
|
||||||
// collection title/list...
|
// collection title/list...
|
||||||
['renameCollection',
|
['renameCollection',
|
||||||
function(_, from, to){
|
function(_, from, to){
|
||||||
@ -1279,8 +1313,12 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
// // Collection gid-title index...
|
// // Collection gid-title index...
|
||||||
// //
|
// //
|
||||||
// // NOTE: this is sorted via .collection_order...
|
// // NOTE: this is sorted via .collection_order...
|
||||||
// collection-index: {
|
// collections: {
|
||||||
// <gid>: <title>,
|
// <gid>: {
|
||||||
|
// title: <title>,
|
||||||
|
// count: <count>,
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -1354,7 +1392,12 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
// correct order...
|
// correct order...
|
||||||
Object.keys(res.raw.collections || {})
|
Object.keys(res.raw.collections || {})
|
||||||
.forEach(function(title){
|
.forEach(function(title){
|
||||||
index[collections[title].gid || title] = title })
|
var m = index[collections[title].gid || title] = { title: title }
|
||||||
|
|
||||||
|
if(res.raw.collections[title].count){
|
||||||
|
m['count'] = res.raw.collections[title].count
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// collections...
|
// collections...
|
||||||
@ -1420,20 +1463,25 @@ module.Collection = core.ImageGridFeatures.Feature({
|
|||||||
// collection index...
|
// collection index...
|
||||||
var collections = {}
|
var collections = {}
|
||||||
var collections_index = {}
|
var collections_index = {}
|
||||||
//var index = json['collection-index']
|
|
||||||
var index = json['collections']
|
var index = json['collections']
|
||||||
index
|
index
|
||||||
&& Object.keys(index).forEach(function(gid){
|
&& Object.keys(index).forEach(function(gid){
|
||||||
var title = index[gid]
|
//var title = index[gid]
|
||||||
|
var title = index[gid].title || index[gid]
|
||||||
var path = 'collections/'+ gid
|
var path = 'collections/'+ gid
|
||||||
|
|
||||||
collections_index[gid] = collections[title] = {
|
var m = collections_index[gid] = collections[title] = {
|
||||||
gid: gid,
|
gid: gid,
|
||||||
title: title,
|
title: title,
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
path: path,
|
path: path,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(index[gid].count){
|
||||||
|
m.count = index[gid].count
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if(Object.keys(collections).length > 0){
|
if(Object.keys(collections).length > 0){
|
||||||
@ -1958,6 +2006,7 @@ var UICollectionActions = actions.Actions({
|
|||||||
})],
|
})],
|
||||||
|
|
||||||
// XXX would be nice to make this nested (i.e. path list)...
|
// XXX would be nice to make this nested (i.e. path list)...
|
||||||
|
// XXX do .markChanged('collections') after sorting...
|
||||||
browseCollections: ['Collections/$Collec$tions...',
|
browseCollections: ['Collections/$Collec$tions...',
|
||||||
core.doc`Collection list...
|
core.doc`Collection list...
|
||||||
|
|
||||||
@ -2019,7 +2068,7 @@ var UICollectionActions = actions.Actions({
|
|||||||
unsaved
|
unsaved
|
||||||
&& text.attr('unsaved', true)
|
&& text.attr('unsaved', true)
|
||||||
|
|
||||||
// indicate collection crop...
|
// collection crop...
|
||||||
var cs =
|
var cs =
|
||||||
title == (that.collection || MAIN_COLLECTION_TITLE) ?
|
title == (that.collection || MAIN_COLLECTION_TITLE) ?
|
||||||
that.crop_stack
|
that.crop_stack
|
||||||
@ -2028,6 +2077,17 @@ var UICollectionActions = actions.Actions({
|
|||||||
: null
|
: null
|
||||||
cs
|
cs
|
||||||
&& text.attr('cropped', cs.length)
|
&& text.attr('cropped', cs.length)
|
||||||
|
|
||||||
|
// collection size...
|
||||||
|
var c = (that.collections || {})[title] || {}
|
||||||
|
var i = (c.data && c.data.length)
|
||||||
|
|| c.count
|
||||||
|
|| false
|
||||||
|
// main collection loaded...
|
||||||
|
i = (!i && title == MAIN_COLLECTION_TITLE && !that.collection) ?
|
||||||
|
that.data.length
|
||||||
|
: i
|
||||||
|
i && $(this).attr('count', i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update collection list if changed externally...
|
// update collection list if changed externally...
|
||||||
@ -2050,21 +2110,27 @@ var UICollectionActions = actions.Actions({
|
|||||||
&& make([
|
&& make([
|
||||||
MAIN_COLLECTION_TITLE,
|
MAIN_COLLECTION_TITLE,
|
||||||
],
|
],
|
||||||
{ events: {
|
{
|
||||||
update: function(_, title){
|
events: {
|
||||||
// make this look almost like a list element...
|
update: function(_, title){
|
||||||
// XXX hack???
|
// make this look almost like a list element...
|
||||||
$(this).find('.text:first-child')
|
// XXX hack???
|
||||||
.before($('<span>')
|
$(this).find('.text:first-child')
|
||||||
.css('color', 'transparent')
|
.before($('<span>')
|
||||||
.addClass('sort-handle')
|
.css('color', 'transparent')
|
||||||
.html('☰'))
|
.addClass('sort-handle')
|
||||||
setItemState
|
.html('☰'))
|
||||||
//.call($(this), title)
|
setItemState
|
||||||
.call($(this), $(this).find('.text').attr('text'))
|
//.call($(this), title)
|
||||||
|
.call($(this), $(this).find('.text').attr('text'))
|
||||||
|
},
|
||||||
|
open: openHandler,
|
||||||
},
|
},
|
||||||
open: openHandler,
|
// NOTE: we are adding a blank button here
|
||||||
}})
|
// to align item counts...
|
||||||
|
// XXX HACK: can we automate this -- html5 grid layout???
|
||||||
|
buttons: [['×']],
|
||||||
|
})
|
||||||
|
|
||||||
// collection list...
|
// collection list...
|
||||||
make.EditableList(collections,
|
make.EditableList(collections,
|
||||||
@ -2435,6 +2501,7 @@ var FileSystemCollectionActions = actions.Actions({
|
|||||||
|
|
||||||
logger && logger.emit('title', title)
|
logger && logger.emit('title', title)
|
||||||
|
|
||||||
|
c.count = c.data.length
|
||||||
delete c.data
|
delete c.data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2682,22 +2682,30 @@ var BrowserPrototype = {
|
|||||||
var html = e[0]
|
var html = e[0]
|
||||||
var func = e[1]
|
var func = e[1]
|
||||||
|
|
||||||
btn.append($('<div>')
|
// blank button...
|
||||||
.addClass('button')
|
if(func == null){
|
||||||
.html(html)
|
btn.append($('<div>')
|
||||||
.click(function(evt){
|
.addClass('button blank')
|
||||||
// prevent clicks from triggering the item action...
|
.html(html))
|
||||||
evt.stopPropagation()
|
|
||||||
|
|
||||||
// action name...
|
} else {
|
||||||
if(typeof(func) == typeof('str')){
|
btn.append($('<div>')
|
||||||
that[func](txt, res)
|
.addClass('button')
|
||||||
|
.html(html)
|
||||||
|
.click(function(evt){
|
||||||
|
// prevent clicks from triggering the item action...
|
||||||
|
evt.stopPropagation()
|
||||||
|
|
||||||
// handler...
|
// action name...
|
||||||
} else {
|
if(typeof(func) == typeof('str')){
|
||||||
func.call(that, txt, res)
|
that[func](txt, res)
|
||||||
}
|
|
||||||
}))
|
// handler...
|
||||||
|
} else {
|
||||||
|
func.call(that, txt, res)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//--------------------------------- user event handlers ---
|
//--------------------------------- user event handlers ---
|
||||||
|
|||||||
3468
ui (gen4)/package-lock.json
generated
3468
ui (gen4)/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
|||||||
"ig-actions": "^3.10.0",
|
"ig-actions": "^3.10.0",
|
||||||
"ig-features": "^3.3.2",
|
"ig-features": "^3.3.2",
|
||||||
"ig-object": "^1.0.2",
|
"ig-object": "^1.0.2",
|
||||||
|
"npm": "^5.6.0",
|
||||||
"openseadragon": "^2.3.1",
|
"openseadragon": "^2.3.1",
|
||||||
"pica": "^3.0.6",
|
"pica": "^3.0.6",
|
||||||
"preact": "^8.2.6",
|
"preact": "^8.2.6",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user