mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
cleanup and minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
95e0e9c77a
commit
0eb201fb06
@ -1563,12 +1563,12 @@ module.CropActions = actions.Actions({
|
||||
// XXX save a crop (catalog)..
|
||||
// XXX
|
||||
|
||||
cropBefore: ['Crop/Crop current and $befor$e',
|
||||
cropBefore: ['Crop|Image/Crop current and $befor$e',
|
||||
function(image, flatten){
|
||||
image = image || this.current
|
||||
var list = this.data.getImages()
|
||||
return this.crop(list.slice(0, list.indexOf(image)+1), flatten) }],
|
||||
cropAfter: ['Crop/Crop current and $after',
|
||||
cropAfter: ['Crop|Image/Crop current and $after',
|
||||
function(image, flatten){
|
||||
image = image || this.current
|
||||
var list = this.data.getImages()
|
||||
@ -1621,7 +1621,7 @@ module.CropActions = actions.Actions({
|
||||
|
||||
this.crop(crop, flatten)
|
||||
}],
|
||||
cropOutRibbonsBelow: ['Crop/Crop out ribbons be$low',
|
||||
cropOutRibbonsBelow: ['Crop|Ribbon/Crop out ribbons be$low',
|
||||
function(ribbon, flatten){
|
||||
if(this.data.length == 0){
|
||||
return
|
||||
|
||||
@ -2447,120 +2447,8 @@ object.Constructor('Task', {
|
||||
})
|
||||
|
||||
|
||||
// XXX add .toString(..)
|
||||
var bareEventMethod = function(name, func, options={}){
|
||||
var hidden
|
||||
var method
|
||||
return object.mixinFlat(
|
||||
method = function(func, mode){
|
||||
var handlers =
|
||||
// hidden...
|
||||
options.handlerLocation == 'hidden' ?
|
||||
(hidden = hidden || [])
|
||||
// function...
|
||||
: options.handlerLocation == 'method' ?
|
||||
(method.__event_handlers__ = method.__event_handlers__ || [])
|
||||
// context (default)...
|
||||
: ((this.__event_handlers__ = this.__event_handlers__ || {})[name] =
|
||||
this.__event_handlers__[name] || [])
|
||||
|
||||
var args = [...arguments]
|
||||
var handle = function(){
|
||||
handlers
|
||||
.forEach(function(handler){
|
||||
handler(...args) }) }
|
||||
var res
|
||||
func ?
|
||||
(res = func.call(this, handle, ...args))
|
||||
: handle(...args)
|
||||
|
||||
return res },
|
||||
{
|
||||
__event__: true,
|
||||
get __event_handler_location__(){
|
||||
return ['hidden', 'method'].includes(options.handlerLocation) ?
|
||||
options.handlerLocation
|
||||
: 'context' },
|
||||
__event_handler_remove__: function(context, func){
|
||||
var handlers =
|
||||
(options.handlerLocation == 'hidden' ?
|
||||
hidden
|
||||
: options.handlerLocation == 'method' ?
|
||||
method.__event_handlers__
|
||||
: (context.__event_handlers__ || {})[name]) || []
|
||||
handlers.splice(handlers.indexOf(func), 1)
|
||||
return this },
|
||||
toString: function(){
|
||||
return func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1') },
|
||||
}) }
|
||||
|
||||
|
||||
//
|
||||
// eventMethod(name[, func])
|
||||
// -> method
|
||||
//
|
||||
//
|
||||
// Bind handler...
|
||||
// method(handler)
|
||||
// -> this
|
||||
//
|
||||
// Unbind handler...
|
||||
// method(handler, false)
|
||||
// -> this
|
||||
//
|
||||
// Trigger handlers...
|
||||
// method(...args)
|
||||
// -> this
|
||||
//
|
||||
//
|
||||
// func(handle, ...args)
|
||||
//
|
||||
//
|
||||
// XXX move this someplace generic...
|
||||
// XXX should this be an EventFunction callable...
|
||||
var eventMethod = function(name, func, options={}){
|
||||
return Object.assign(
|
||||
bareEventMethod(name,
|
||||
function(handle, ...args){
|
||||
// add handler...
|
||||
// XXX handle handler tags...
|
||||
if(typeof(args[0]) == 'function'){
|
||||
var handlers =
|
||||
// hidden...
|
||||
options.handlerLocation == 'hidden' ?
|
||||
(hidden = hidden || [])
|
||||
// function...
|
||||
: options.handlerLocation == 'method' ?
|
||||
(method.__event_handlers__ = method.__event_handlers__ || [])
|
||||
// context (default)...
|
||||
: ((this.__event_handlers__ = this.__event_handlers__ || {})[name] =
|
||||
this.__event_handlers__[name] || [])
|
||||
// add handler...
|
||||
handlers.push(args[1])
|
||||
|
||||
// call the action...
|
||||
} else {
|
||||
func.call(handle, ...args) }
|
||||
|
||||
return this },
|
||||
options),
|
||||
{
|
||||
// NOTE: this is a copy of bareEventMethod's .toString() as we
|
||||
// still need to base the doc on the user's func...
|
||||
toString: function(){
|
||||
return func.toString()
|
||||
.replace(/^(function[^(]*\()[^,)]*, ?/, '$1') },
|
||||
}) }
|
||||
|
||||
var EventHandlerMixin = {
|
||||
on: function(event, func){
|
||||
},
|
||||
off: function(event, func){
|
||||
},
|
||||
trigger: function(event, ...args){
|
||||
},
|
||||
}
|
||||
// XXX
|
||||
var events = require('lib/types/event')
|
||||
|
||||
|
||||
var taskAction =
|
||||
|
||||
14
Viewer/package-lock.json
generated
14
Viewer/package-lock.json
generated
@ -1112,16 +1112,16 @@
|
||||
}
|
||||
},
|
||||
"ig-object": {
|
||||
"version": "5.2.8",
|
||||
"resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.2.8.tgz",
|
||||
"integrity": "sha512-EzT4CP6d6lI8bnknNgT3W8mUQhSVXflO0yPbKD4dKsFcINiC6npjoEBz+8m3VQmWJhc+36pXD4JLwNxUEgzi+Q=="
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.3.0.tgz",
|
||||
"integrity": "sha512-8I3w0Gqv96cx1Eirqrvtuh4Pq8X4U3tAexj4nMwceNu4jzZF1wg9FP3Im5ZZ99kQSk7CWl4tjSGe/aS5IXEoMw=="
|
||||
},
|
||||
"ig-types": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-3.5.2.tgz",
|
||||
"integrity": "sha512-oKI8eGHSt3Q1BlVG6GQ6DaKg7r/nt2PQ/NPqd2i2q7fvYF6HY4cc+YNpSvJ+TN50I6QVfwiXOIEhPqi8jwViUg==",
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-3.6.0.tgz",
|
||||
"integrity": "sha512-zLy40mWfYXPeCw82zoAapgUUvpGvF0GNSZTAEX1s/qpAP2YYR9SnvP8QEJ1N/LqyNSpSC3q+axsBVYEqIgW2fg==",
|
||||
"requires": {
|
||||
"ig-object": "^5.2.8",
|
||||
"ig-object": "^5.3.0",
|
||||
"object-run": "^1.0.1"
|
||||
}
|
||||
},
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
"ig-actions": "^3.24.11",
|
||||
"ig-argv": "^2.15.0",
|
||||
"ig-features": "^3.4.2",
|
||||
"ig-object": "^5.2.8",
|
||||
"ig-types": "^3.5.2",
|
||||
"ig-object": "^5.3.0",
|
||||
"ig-types": "^3.6.0",
|
||||
"moment": "^2.29.1",
|
||||
"object-run": "^1.0.1",
|
||||
"requirejs": "^2.3.6",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user