mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
added shift to top/bottom actions + minor refactoring of base feature -- not done yet...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1eebfe3020
commit
4a3b5f5f0b
@ -850,6 +850,17 @@ actions.Actions({
|
||||
return this.current_ribbon == this.base && 'disabled' }},
|
||||
function(target){ this.data.setBase(target) }],
|
||||
|
||||
getNextFocused: ['- Image/',
|
||||
function(target='current', set_direction=true){
|
||||
var direction = this.direction == 'right' ? 'next' : 'prev'
|
||||
var cur = this.data.getImage(target)
|
||||
var next = this.data.getImage(direction)
|
||||
|| this.data.getImage(direction == 'next' ? 'prev' : 'next')
|
||||
set_direction
|
||||
&& this.config['shifts-affect-direction'] == 'on'
|
||||
&& (this.direction = this.direction)
|
||||
return next }],
|
||||
|
||||
// NOTE: this does not retain direction information, handle individual
|
||||
// actions if that info is needed.
|
||||
// NOTE: to make things clean, this is triggered in action handlers
|
||||
@ -886,25 +897,13 @@ actions.Actions({
|
||||
function(target){
|
||||
// by default we need to focus another image in the same ribbon...
|
||||
if(target == null){
|
||||
var direction = this.direction == 'right' ? 'next' : 'prev'
|
||||
|
||||
var cur = this.data.getImage()
|
||||
var next = this.data.getImage(direction)
|
||||
next = next == null
|
||||
? this.data.getImage(direction == 'next' ? 'prev' : 'next')
|
||||
: next
|
||||
|
||||
var cur = this.current
|
||||
var next = this.getNextFocused(cur)
|
||||
this.data.shiftImageUp(cur)
|
||||
this.focusImage(next)
|
||||
|
||||
this.config['shifts-affect-direction'] == 'on'
|
||||
&& (this.direction = this.direction)
|
||||
|
||||
// if a specific target is given, just shift it...
|
||||
} else {
|
||||
this.data.shiftImageUp(target)
|
||||
}
|
||||
}],
|
||||
this.data.shiftImageUp(target) } }],
|
||||
shiftImageDown: ['Edit|Image/Shift image down',
|
||||
core.doc`Shift image down...
|
||||
|
||||
@ -916,25 +915,13 @@ actions.Actions({
|
||||
function(target){
|
||||
// by default we need to focus another image in the same ribbon...
|
||||
if(target == null){
|
||||
var direction = this.direction == 'right' ? 'next' : 'prev'
|
||||
|
||||
var cur = this.data.getImage()
|
||||
var next = this.data.getImage(direction)
|
||||
next = next == null
|
||||
? this.data.getImage(direction == 'next' ? 'prev' : 'next')
|
||||
: next
|
||||
|
||||
var cur = this.current
|
||||
var next = this.getNextFocused(cur)
|
||||
this.data.shiftImageDown(cur)
|
||||
this.focusImage(next)
|
||||
|
||||
this.config['shifts-affect-direction'] == 'on'
|
||||
&& (this.direction = this.direction)
|
||||
|
||||
// if a specific target is given, just shift it...
|
||||
} else {
|
||||
this.data.shiftImageDown(target)
|
||||
}
|
||||
}],
|
||||
this.data.shiftImageDown(target) } }],
|
||||
// NOTE: we do not need undo here because it will be handled by
|
||||
// corresponding normal shift operations...
|
||||
// XXX .undoLast(..) on these for some reason skips...
|
||||
@ -943,34 +930,59 @@ actions.Actions({
|
||||
{journal: true},
|
||||
function(target){
|
||||
this.data.newRibbon(target)
|
||||
this.shiftImageUp(target)
|
||||
}],
|
||||
this.shiftImageUp(target) }],
|
||||
shiftImageDownNewRibbon: ['Edit|Image/Shift image down to a new empty ribbon',
|
||||
{journal: true},
|
||||
function(target){
|
||||
this.data.newRibbon(target, 'below')
|
||||
this.shiftImageDown(target)
|
||||
}],
|
||||
this.shiftImageDown(target) }],
|
||||
shiftImageLeft: ['Edit|Sort|Image/Shift image left', {
|
||||
undo: undoShift('shiftImageRight'),
|
||||
mode: 'prevImage'},
|
||||
function(target){
|
||||
if(target == null){
|
||||
this.direction = 'left'
|
||||
}
|
||||
this.direction = 'left' }
|
||||
this.data.shiftImageLeft(target)
|
||||
this.focusImage()
|
||||
}],
|
||||
this.focusImage() }],
|
||||
shiftImageRight: ['Edit|Sort|Image/Shift image right', {
|
||||
undo: undoShift('shiftImageLeft'),
|
||||
mode: 'nextImage'},
|
||||
function(target){
|
||||
if(target == null){
|
||||
this.direction = 'right'
|
||||
}
|
||||
this.direction = 'right' }
|
||||
this.data.shiftImageRight(target)
|
||||
this.focusImage()
|
||||
}],
|
||||
this.focusImage() }],
|
||||
// XXX these are effectively identical...
|
||||
// XXX when shifting the first image in ribbon alignment is a bit off...
|
||||
// XXX add undo...
|
||||
shiftImageToTop: ['Edit|Image/Shift image to top ribbon',
|
||||
function(target){
|
||||
console.warn('shiftImageToTop(..)/shiftImageToBottom(..): need proper undo.')
|
||||
if(target == null){
|
||||
var cur = this.current
|
||||
var next = this.getNextFocused(cur)
|
||||
this.data.shiftImage(cur, 0, 'vertical')
|
||||
this.focusImage(next)
|
||||
} else {
|
||||
this.data.shiftImage(target, 0, 'vertical') } }],
|
||||
shiftImageToBottom: ['Edit|Image/Shift image to bottom ribbon',
|
||||
function(target){
|
||||
console.warn('shiftImageToTop(..)/shiftImageToBottom(..): need proper undo.')
|
||||
if(target == null){
|
||||
var cur = this.current
|
||||
var next = this.getNextFocused(cur)
|
||||
this.data.shiftImage(cur, -1, 'vertical')
|
||||
this.focusImage(next)
|
||||
} else {
|
||||
this.data.shiftImage(target, 0, 'vertical') } }],
|
||||
/*
|
||||
shiftImageToBase: ['Edit|Image/Shift image to base robbon',
|
||||
function(){}],
|
||||
shiftImageOneOverUp: ['Edit|Image/',
|
||||
function(){}],
|
||||
shiftImageOneOverDown: ['Edit|Image/',
|
||||
function(){}],
|
||||
//*/
|
||||
|
||||
shiftRibbonUp: ['Ribbon|Edit|Sort/Shift ribbon up', {
|
||||
undo: undoShift('shiftRibbonDown'),
|
||||
|
||||
@ -2463,14 +2463,12 @@ module.Workspace = ImageGridFeatures.Feature({
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Tasks...
|
||||
// XXX we need:
|
||||
// - serialize/restore
|
||||
//
|
||||
// XXX should this be a separate module???
|
||||
//var tasks = require('lib/tasks')
|
||||
|
||||
// Task wrapper...
|
||||
//
|
||||
// This simply makes tasks actions discoverable...
|
||||
var Task =
|
||||
module.Tast =
|
||||
module.Task =
|
||||
function(func){
|
||||
func.__task__ = true
|
||||
return func }
|
||||
@ -2497,6 +2495,8 @@ function(func){
|
||||
// during the later form 'sync' is passed to .Task(..) in the correct
|
||||
// position...
|
||||
// (see ig-types' runner.TaskManager(..) for more info)
|
||||
//
|
||||
// XXX might be nice to add metadata like start times and the like...
|
||||
var taskAction =
|
||||
module.taskAction =
|
||||
function(title, func){
|
||||
|
||||
@ -300,10 +300,10 @@ module.GLOBAL_KEYBOARD = {
|
||||
|
||||
Home: 'firstImage',
|
||||
ctrl_Home: 'firstGlobalImage',
|
||||
shift_Home: 'firstRibbon',
|
||||
alt_Home: 'firstRibbon',
|
||||
End: 'lastImage',
|
||||
ctrl_End: 'lastGlobalImage',
|
||||
shift_End: 'lastRibbon',
|
||||
alt_End: 'lastRibbon',
|
||||
// NOTE: these (vim-like) bindings have been added by request as
|
||||
// it would seem that not all keyboards have a convenient
|
||||
// Home/End buttons...
|
||||
@ -322,12 +322,14 @@ module.GLOBAL_KEYBOARD = {
|
||||
alt_shift_Up: 'travelImageUp',
|
||||
ctrl_shift_Up: 'shiftImageUpNewRibbon',
|
||||
ctrl_Up: 'shiftMarkedUp',
|
||||
shift_Home: 'shiftImageToTop',
|
||||
|
||||
shift_Down: 'shiftImageDown',
|
||||
caps_Down: 'shiftImageDown',
|
||||
alt_shift_Down: 'travelImageDown',
|
||||
ctrl_shift_Down: 'shiftImageDownNewRibbon',
|
||||
ctrl_Down: 'shiftMarkedDown',
|
||||
shift_End: 'shiftImageToBottom',
|
||||
|
||||
alt_Left: 'shiftImageLeft!',
|
||||
alt_Right: 'shiftImageRight!',
|
||||
|
||||
@ -25,6 +25,7 @@ if(typeof(process) != 'undefined'){
|
||||
|
||||
var util = require('lib/util')
|
||||
var toggler = require('lib/toggler')
|
||||
// XXX do we need this???
|
||||
var tasks = require('lib/tasks')
|
||||
var keyboard = require('lib/keyboard')
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
*
|
||||
* XXX is this needed???
|
||||
*
|
||||
**********************************************************************/
|
||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||
|
||||
8
Viewer/package-lock.json
generated
8
Viewer/package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ImageGrid.Viewer.g4",
|
||||
"version": "4.0.0-a",
|
||||
"version": "4.0.0a",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1110,9 +1110,9 @@
|
||||
"integrity": "sha512-9kZM80Js9/eTwXN9VXwLDC1wDJ7gIAdYU9GIzb5KJmNcLAMaW+zhgFrwFFMrcSfggUuadgnqSrS41E4XLe8JZw=="
|
||||
},
|
||||
"ig-types": {
|
||||
"version": "5.0.20",
|
||||
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-5.0.20.tgz",
|
||||
"integrity": "sha512-d2IEwY3ZDSWxn2PY0e7XxMzuOPWzeK/py0sBgqfoCNbKlc4IHEogFwoQIv0C4EZdcXL0cJOsCo74NwbetoSWiA==",
|
||||
"version": "5.0.21",
|
||||
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-5.0.21.tgz",
|
||||
"integrity": "sha512-902m+C7h6/IE6qlD3LzP+fbDstXMEVKltdOgc9YHQWWCK4zI9IgUckp5lJrrDRsZsaDsKAUIUVcYbAfkxKeOdg==",
|
||||
"requires": {
|
||||
"ig-object": "^5.4.12",
|
||||
"object-run": "^1.0.1"
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
"ig-argv": "^2.15.0",
|
||||
"ig-features": "^3.4.2",
|
||||
"ig-object": "^5.4.12",
|
||||
"ig-types": "^5.0.20",
|
||||
"ig-types": "^5.0.21",
|
||||
"moment": "^2.29.1",
|
||||
"object-run": "^1.0.1",
|
||||
"requirejs": "^2.3.6",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user