added focus first/last globally image actions + tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-10-22 13:11:26 +04:00
parent 0b32958599
commit 739ca6eb55
3 changed files with 18 additions and 6 deletions

View File

@ -1346,7 +1346,6 @@ module.DataPrototype = {
// NOTE: this may result in empty ribbons... // NOTE: this may result in empty ribbons...
// NOTE: this will not crop the .order... // NOTE: this will not crop the .order...
// //
// XXX flatten as an option...
// XXX should this link to .root and .parent data??? // XXX should this link to .root and .parent data???
crop: function(list, flatten){ crop: function(list, flatten){
var crop = this.clone() var crop = this.clone()
@ -1398,6 +1397,7 @@ module.DataPrototype = {
// //
// NOTE: this may result in empty ribbons... // NOTE: this may result in empty ribbons...
// //
// XXX what are we doing with new ribbons???
// XXX sync ribbon order??? // XXX sync ribbon order???
// XXX should we be able to align a merged crop??? // XXX should we be able to align a merged crop???
// XXX test // XXX test

View File

@ -89,13 +89,16 @@ module.GLOBAL_KEYBOARD = {
}, },
// XXX testing... // XXX testing...
Home: { Home: {
default: 'firstImage', default: 'firstImage',
ctrl: 'firstRibbon', ctrl: 'firstGlobalImage',
shift: 'firstRibbon',
}, },
End: { End: {
default: 'lastImage', default: 'lastImage',
ctrl: 'lastRibbon', ctrl: 'lastGlobalImage',
shift: 'lastRibbon',
}, },
Left: { Left: {
default: 'prevImage', default: 'prevImage',

View File

@ -150,6 +150,8 @@ actions.Actions({
function(img, list){ function(img, list){
this.data.focusImage(img, list) this.data.focusImage(img, list)
}], }],
focusRibbon: ['Focus Ribbon', focusRibbon: ['Focus Ribbon',
function(target){ function(target){
var data = this.data var data = this.data
@ -175,11 +177,15 @@ actions.Actions({
setBaseRibbon: ['Set base ribbon', setBaseRibbon: ['Set base ribbon',
function(target){ this.data.setBase(target) }], function(target){ this.data.setBase(target) }],
// shorthands for .focusImage(..) and .focusRibbon(..)...
firstImage: ['Focus first image in current ribbon', firstImage: ['Focus first image in current ribbon',
function(){ this.focusImage('first') }], function(all){ this.focusImage(all == null ? 'first' : 0) }],
lastImage: ['Focus last image in current ribbon', lastImage: ['Focus last image in current ribbon',
function(){ this.focusImage('last') }], function(all){ this.focusImage(all == null ? 'last' : -1) }],
firstGlobalImage: ['Get first globally image',
function(){ this.firstImage(true) }],
lastGlobalImage: ['Get last globally image',
function(){ this.lastImage(true) }],
prevImage: ['Focus previous image', prevImage: ['Focus previous image',
function(a){ function(a){
@ -217,6 +223,7 @@ actions.Actions({
nextImageInOrder: ['Focus next image in order', nextImageInOrder: ['Focus next image in order',
function(){ this.nextImage(this.data.order) }], function(){ this.nextImage(this.data.order) }],
firstRibbon: ['Focus previous ribbon', firstRibbon: ['Focus previous ribbon',
function(){ this.focusRibbon('first') }], function(){ this.focusRibbon('first') }],
lastRibbon: ['Focus next ribbon', lastRibbon: ['Focus next ribbon',
@ -627,6 +634,7 @@ actions.Actions(Client, {
// + usable as-is without any extra "features" // + usable as-is without any extra "features"
// - not customizable without rewriting... // - not customizable without rewriting...
// - might be too monolithic (god object?) // - might be too monolithic (god object?)
// ...need to think about it a bit more...
focusImage: [ focusImage: [
function(target, list){ function(target, list){
var ribbons = this.ribbons var ribbons = this.ribbons
@ -786,6 +794,7 @@ actions.Actions(Client, {
// XXX should these call .images.* or should it be done by data... // XXX should these call .images.* or should it be done by data...
// ...I think that data is a better candidate as it should be // ...I think that data is a better candidate as it should be
// standalone... // standalone...
// XXX should we have .rotate(..) and .flip(..) generic actions???
rotateCW: [ rotateCW: [
function(target){ this.ribbons.rotateCW(target) }], function(target){ this.ribbons.rotateCW(target) }],
rotateCCW: [ rotateCCW: [