some generalization and refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-14 17:38:04 +04:00
parent db736cea92
commit 393846549d
2 changed files with 20 additions and 9 deletions

View File

@ -112,7 +112,7 @@ Priority work
[X] disable transitions... [X] disable transitions...
[_] basic wrapper [_] basic wrapper
| hook-in os-specific API | hook-in os-specific API
[_] 23% Preview II (optional features) [_] 25% Preview II (optional features)
[_] slideshow... [_] slideshow...
[_] 50% serialization/deserialization [_] 50% serialization/deserialization
[X] JSON loader/unloader [X] JSON loader/unloader
@ -153,10 +153,10 @@ Priority work
[_] double tap/click to zoom (a-la iPad) [_] double tap/click to zoom (a-la iPad)
| fit <-> actual pixels (max) | fit <-> actual pixels (max)
[_] pinch to zoom [_] pinch to zoom
[_] 33% add sort/re-sort capability... [_] 66% add sort/re-sort capability...
[X] abstract out image id [X] abstract out image id
[_] replace id (use something else like filename) [_] replace id (use something else like filename)
[_] in-place sort ribbons [X] in-place sort ribbons
[_] 50% option to disable processor intensive features [_] 50% option to disable processor intensive features
[X] global transitions [X] global transitions
[_] global opacity -- do a layout without opacity [_] global opacity -- do a layout without opacity
@ -203,9 +203,13 @@ Priority work
[X] viewer [X] viewer
[_] select source [_] select source
[_] slideshow [_] slideshow
[X] 100% ribbon sorting [X] 100% image sorting
[X] ribbon navigation [X] ribbon navigation
[X] shift image between ribbons [X] shift image between ribbons
[X] 100% basic large scale operations
[X] sort all images
[X] reverse all images
[X] reverse ribbons
[_] 0% metadata [_] 0% metadata
[_] tag filtering [_] tag filtering
[_] tag editing [_] tag editing

View File

@ -1103,6 +1103,7 @@ var shiftImageUp = function(){ return shiftImage('prev') }
// reverse the ribbon order... // reverse the ribbon order...
// NOTE: this is like flipping the field vertically...
function reverseRibbons(){ function reverseRibbons(){
var ribbons = $('.ribbon') var ribbons = $('.ribbon')
var field = $('.field') var field = $('.field')
@ -1129,18 +1130,24 @@ function sortImages(){
} }
// use the cmp function to update image id's and resort...
// this will reverse the order of images in all ribbons by reversing function resortImagesVia(cmp){
// id attr and resorting...
function reverseImageOrder(){
// reverse ID order... // reverse ID order...
$($('.image').get().sort(cmpImageOrder).reverse()) $($('.image').get().sort(cmp))
.each(function(i, e){$(e).attr({'id': i})}) .each(function(i, e){$(e).attr({'id': i})})
// resort the images... // resort the images...
sortImages() sortImages()
} }
// reverse the order of images in all ribbons by reversing their id attr
// and resorting...
// NOTE: this is like flipping the field horizontally...
function reverseImageOrder(){
resortImagesVia(function(a, b){return cmpImageOrder(b, a)})
}
/*********************************************************************/ /*********************************************************************/