mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
some tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6ed2d1ebd5
commit
ed58ff4cc8
@ -474,10 +474,11 @@ module.ImageMarksUI = core.ImageGridFeatures.Feature({
|
|||||||
function(ribbon){ this.reload(true) }],
|
function(ribbon){ this.reload(true) }],
|
||||||
|
|
||||||
// XXX is this the right way to go???
|
// XXX is this the right way to go???
|
||||||
['updateImage', function(_, gid, img){
|
['updateImage', function(_, gid, img, options){
|
||||||
// NOTE: we are not using .toggleMark(..) here as this
|
// NOTE: we are not using .toggleMark(..) here as this
|
||||||
// does not need to depend on the 'edit' feature...
|
// does not need to depend on the 'edit' feature...
|
||||||
this.ribbons
|
!(options || {}).nochrome
|
||||||
|
&& this.ribbons
|
||||||
&& this.ribbons
|
&& this.ribbons
|
||||||
.toggleImageMark(
|
.toggleImageMark(
|
||||||
gid,
|
gid,
|
||||||
@ -592,8 +593,9 @@ module.ImageBookmarksUI = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
// XXX is this the right way to go???
|
// XXX is this the right way to go???
|
||||||
['updateImage', function(_, gid, img){
|
['updateImage', function(_, gid, img, options){
|
||||||
this.ribbons
|
!(options || {}).nochrome
|
||||||
|
&& this.ribbons
|
||||||
&& this.ribbons
|
&& this.ribbons
|
||||||
.toggleImageMark(
|
.toggleImageMark(
|
||||||
gid,
|
gid,
|
||||||
|
|||||||
@ -366,16 +366,16 @@ var MetadataUIActions = actions.Actions({
|
|||||||
make.Separator()
|
make.Separator()
|
||||||
make.Spinner() }
|
make.Spinner() }
|
||||||
// XXX BUG: this when attached is stealing marks from
|
// XXX BUG: this when attached is stealing marks from
|
||||||
// the original image in ribbon and sows them in
|
// the original image in ribbon...
|
||||||
// the dialog...
|
|
||||||
// ...need to avoid both!
|
|
||||||
make.dialog.updatePreview = function(){
|
make.dialog.updatePreview = function(){
|
||||||
var preview = this.preview = this.preview || that.ribbons.createImage(image)
|
var preview = this.preview = this.preview || that.ribbons.createImage(image)
|
||||||
return that.ribbons.updateImage(preview, image, preview_size, false,
|
return that.ribbons.updateImage(preview, image, preview_size, false, {
|
||||||
function([p]){
|
nochrome: true,
|
||||||
p.classList.add('clone', 'preview')
|
pre_updaters_callback: function([p]){
|
||||||
p.style.height = preview_size +'px'
|
p.classList.add('clone', 'preview')
|
||||||
p.style.width = preview_size +'px'
|
p.style.height = preview_size +'px'
|
||||||
|
p.style.width = preview_size +'px'
|
||||||
|
},
|
||||||
}) }
|
}) }
|
||||||
|
|
||||||
make(['Preview:', this.updatePreview()])
|
make(['Preview:', this.updatePreview()])
|
||||||
|
|||||||
@ -1447,7 +1447,7 @@ var RibbonsPrototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// XXX is .__image_updaters the right way to go???
|
// XXX is .__image_updaters the right way to go???
|
||||||
callImageUpdaters: function(gid, image){
|
callImageUpdaters: function(gid, image, options){
|
||||||
gid = gid == null ? this.elemGID() : gid
|
gid = gid == null ? this.elemGID() : gid
|
||||||
image = image == null ? this.getImage() : $(image)
|
image = image == null ? this.getImage() : $(image)
|
||||||
|
|
||||||
@ -1456,7 +1456,7 @@ var RibbonsPrototype = {
|
|||||||
|
|
||||||
;(this.__image_updaters || [])
|
;(this.__image_updaters || [])
|
||||||
.forEach(function(update){
|
.forEach(function(update){
|
||||||
update(gid, image) })
|
update(gid, image, options) })
|
||||||
|
|
||||||
return image
|
return image
|
||||||
},
|
},
|
||||||
@ -1492,6 +1492,14 @@ var RibbonsPrototype = {
|
|||||||
// .updateImage('*')
|
// .updateImage('*')
|
||||||
// -> image
|
// -> image
|
||||||
//
|
//
|
||||||
|
//
|
||||||
|
// options format:
|
||||||
|
// {
|
||||||
|
// nochrome: <bool>,
|
||||||
|
//
|
||||||
|
// pre_updaters_callback: <function>,
|
||||||
|
// }
|
||||||
|
//
|
||||||
// NOTE: this can update collections of images by passing either a
|
// NOTE: this can update collections of images by passing either a
|
||||||
// list of gids, images or a jQuery collection...
|
// list of gids, images or a jQuery collection...
|
||||||
// NOTE: pre_updaters_callback if given is called after image is fully
|
// NOTE: pre_updaters_callback if given is called after image is fully
|
||||||
@ -1520,10 +1528,13 @@ var RibbonsPrototype = {
|
|||||||
// XXX add support for basic image templating here...
|
// XXX add support for basic image templating here...
|
||||||
// ...templates for blank images, text blocks and other stuff,
|
// ...templates for blank images, text blocks and other stuff,
|
||||||
// this would best be done by simply filling in SVG templates...
|
// this would best be done by simply filling in SVG templates...
|
||||||
updateImage: function(image, gid, size, sync, pre_updaters_callback){
|
updateImage: function(image, gid, size, sync, options){
|
||||||
var that = this
|
var that = this
|
||||||
var imgs = this.viewer.find(IMAGE)
|
var imgs = this.viewer.find(IMAGE)
|
||||||
|
|
||||||
|
options = options || {}
|
||||||
|
var pre_updaters_callback = options.pre_updaters_callback
|
||||||
|
|
||||||
// reduce the length of input image set...
|
// reduce the length of input image set...
|
||||||
// NOTE: this will make things substantially faster for very large
|
// NOTE: this will make things substantially faster for very large
|
||||||
// input sets...
|
// input sets...
|
||||||
@ -1534,8 +1545,7 @@ var RibbonsPrototype = {
|
|||||||
|| image.indexOf(that.elemGID(img)) >= 0 })
|
|| image.indexOf(that.elemGID(img)) >= 0 })
|
||||||
.map(function(_, img){
|
.map(function(_, img){
|
||||||
return that.elemGID(img) })
|
return that.elemGID(img) })
|
||||||
.toArray()
|
.toArray() }
|
||||||
}
|
|
||||||
// normalize...
|
// normalize...
|
||||||
image = image == '*' ?
|
image = image == '*' ?
|
||||||
imgs
|
imgs
|
||||||
@ -1663,7 +1673,7 @@ var RibbonsPrototype = {
|
|||||||
that.correctImageProportionsForRotation(img, W, H)
|
that.correctImageProportionsForRotation(img, W, H)
|
||||||
pre_updaters_callback
|
pre_updaters_callback
|
||||||
&& pre_updaters_callback.call(that, image, data)
|
&& pre_updaters_callback.call(that, image, data)
|
||||||
that.callImageUpdaters(data.gid, img)
|
that.callImageUpdaters(data.gid, img, options)
|
||||||
|
|
||||||
return _img
|
return _img
|
||||||
}))
|
}))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user