moved format-specific config to filesystem.IndexFormat feature...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-26 05:36:28 +03:00
parent 85191b261a
commit 9a487c86e6
3 changed files with 47 additions and 17 deletions

View File

@ -35,6 +35,7 @@ LIB_DIR=lib
EXT_LIB_DIR=ext-lib
CSS_DIR=css
FEATURES_DIR=features
WORKERS_DIR=workers
NW_PROJECT_FILE=package.json
JS_FILES := $(wildcard *.js)
HTML_FILES := $(wildcard *.html)
@ -111,7 +112,7 @@ $(APP_ZIP): $(CSS_FILES) $(BUILD_DIR) $(NODE_DIR) $(NW_PROJECT_FILE) \
$(JS_FILES) $(CSS_FILES) $(HTML_FILES)
zip -r $(APP_ZIP) $(NW_PROJECT_FILE) $(JS_FILES) $(CSS_FILES) \
$(HTML_FILES) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \
$(CSS_DIR) \
$(WORKERS_DIR) $(CSS_DIR) \
$(NODE_DIR)/app-module-path
zip: $(APP_ZIP)

View File

@ -45,6 +45,41 @@ if(typeof(process) != 'undefined'){
/*********************************************************************/
var IndexFormat =
module.IndexFormat = core.ImageGridFeatures.Feature({
title: '',
doc: '',
tag: 'index-format',
config: {
'index-dir': '.ImageGrid',
'preview-sizes': [
75,
150,
350,
900,
1000,
1280,
1920,
],
// Supported fields:
// $INDEX - index directory name
// $RESOLUTION - preview resolution
// $GID - image GID
// $NAME - image name
//
// XXX make this used in loader too...
'preview-path-template': '${INDEX}/${RESOLUTION}px/${GID} - ${NAME}.jpg',
},
})
/*********************************************************************/
var FileSystemInfoActions = actions.Actions({
@ -67,6 +102,7 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({
tag: 'fs-info',
depends: [
'location',
'index-format',
],
actions: FileSystemInfoActions,
@ -84,8 +120,6 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({
// NOTE: this will also manage .location.from
var FileSystemLoaderActions = actions.Actions({
config: {
'index-dir': '.ImageGrid',
'image-file-pattern': '*+(jpg|jpeg|png|JPG|JPEG|PNG)',
'image-file-read-stat': true,
@ -1085,7 +1119,6 @@ var FileSystemWriterActions = actions.Actions({
'select',
],
'export-preview-size': 1000,
// XXX add options to indicate:
// - long side
// - short side
@ -1094,12 +1127,12 @@ var FileSystemWriterActions = actions.Actions({
// - ...
// XXX this repeats sharp.SharpActions.config['preview-sizes']
'export-preview-sizes': [
'500',
'900',
'1000',
'1280',
'1920',
],
'export-preview-size': 1000,
},
// This can be:
@ -1565,7 +1598,8 @@ module.FileSystemWriter = core.ImageGridFeatures.Feature({
tag: 'fs-writer',
// NOTE: this is mostly because of the base path handling...
depends: [
'fs-loader'
'fs-loader',
'index-format',
],
suggested: [
'ui-fs-writer',
@ -1975,6 +2009,7 @@ module.FileSystemWriterUI = core.ImageGridFeatures.Feature({
//---------------------------------------------------------------------
core.ImageGridFeatures.Feature('fs', [
'index-format',
'fs-info',
'fs-loader',
'fs-writer',

View File

@ -42,19 +42,10 @@ if(typeof(process) != 'undefined'){
var SharpActions = actions.Actions({
config: {
'preview-path-template': '${INDEX}/${RESOLUTION}px/${GID} - ${NAME}.jpg',
'preview-normalized': true,
// XXX this repeats filesystem.FileSystemWriterActions.config['export-preview-sizes']
'preview-sizes': [
1920,
1280,
900,
350,
150,
75,
]
// NOTE: this uses 'preview-sizes' and 'preview-path-template'
// from filesystem.IndexFormat...
},
// NOTE: post handlers are pushed in .makePreviews(..)
@ -222,6 +213,8 @@ var SharpActions = actions.Actions({
}],
})
// XXX need to auto-generate previews for very large images...
var Sharp =
module.Sharp = core.ImageGridFeatures.Feature({
title: '',
@ -230,6 +223,7 @@ module.Sharp = core.ImageGridFeatures.Feature({
tag: 'sharp',
depends: [
'location',
'index-format',
],
actions: SharpActions,