diff --git a/ui/TODO.otl b/ui/TODO.otl index 1a2157b8..301c98bb 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -99,32 +99,45 @@ Roadmap | | $('[order='+$('.current.image').attr('order')+']').length | - [_] BUG: aligning still sometimes gets off... - | ...after rotating a number of images - | - | XXX this is likely a side effect of loading duplicates... - | - | happens when: - | - getScreenWidthInImages() < 2 - | - looking through images in one direction and back, some get misaligned - | ...this is stable behaviour by centerRibbon(...), - | calling it again will not fix this. - | moving next/prev will fix the issue until it comes back again - | - affected by LOAD_SCREENS and number of images in ribbon - | current figures: - | Ribbon: 18 - | Position going forward: 4 - | Position going back: 1 - | LOAD_SCREENS: 6 - | NOTE: changing LOAD_SCREENS moves the affected positions. - | NOTE: had a similar bug where some images still kept their - | prior sizing after recycling... - | ...check if centerRibbon(...) and correctImageProportionsForRotation(...) - | are called in right sequence... + [_] BUG: aligning still sometimes gets off... + | ...after rotating a number of images + | + | XXX this is likely a side effect of loading duplicates... + | + | happens when: + | - getScreenWidthInImages() < 2 + | - looking through images in one direction and back, some get misaligned + | ...this is stable behaviour by centerRibbon(...), + | calling it again will not fix this. + | moving next/prev will fix the issue until it comes back again + | - affected by LOAD_SCREENS and number of images in ribbon + | current figures: + | Ribbon: 18 + | Position going forward: 4 + | Position going back: 1 + | LOAD_SCREENS: 6 + | NOTE: changing LOAD_SCREENS moves the affected positions. + | NOTE: had a similar bug where some images still kept their + | prior sizing after recycling... + | ...check if centerRibbon(...) and correctImageProportionsForRotation(...) + | are called in right sequence... [_] BUG: jumping screen images does not load the adjacent ribbons... | positioning is OK but ribbons are not fully visible... - [_] BUG: changing window size in single image modes messes things up... + [_] BUG: changing window size (F11) in single image modes messes things up... + | some images are of different sizes (newly loaded) and aligned in a wrong way... + | + | appears not to affect square-fit view... + | | until we cycle to ribbon mode and back... + | + | Q: does this trigger the on-resize event??? + | A: no, not connected... + | + | possible that this is connected with the align/load bug... + | + | appears to be a state leak, this affects: + | - correctImageProportionsForRotation(image) -- mis-alignes images + | while after cycling single image mode, behaves correctly... [_] ASAP: test on Android... [_] 0% Tablet UI [_] screen buttons diff --git a/ui/base.js b/ui/base.js index 4138b555..9ba9cb06 100755 --- a/ui/base.js +++ b/ui/base.js @@ -951,6 +951,7 @@ function correctImageProportionsForRotation(images){ var w = image.outerWidth() var h = image.outerHeight() + // non-square image... if(w != h){ var proportions = W/H - w/h @@ -977,6 +978,7 @@ function correctImageProportionsForRotation(images){ }) } + // square image... } else { image.css({ 'margin': '', diff --git a/ui/index.html b/ui/index.html index dd5cd5ea..6758de1e 100755 --- a/ui/index.html +++ b/ui/index.html @@ -54,6 +54,8 @@ $(function(){ .resize(function() { // XXX should this be animated or not? centerView() + + // XXX problems in single image mode after hitting F11... }) $(document) diff --git a/ui/modes.js b/ui/modes.js index c5884d96..285eb243 100755 --- a/ui/modes.js +++ b/ui/modes.js @@ -153,7 +153,7 @@ var toggleSingleImageMode = createCSSClassToggler('.viewer', w = SETTINGS['screen-images-ribbon-mode'] w = w == null ? DEFAULT_SCREEN_IMAGES : w - toggleImageProportions('square') + toggleImageProportions('fit-square') fitNImages(w) var i = SETTINGS['image-info-ribbon-mode'] == 'on' ? 'on' : 'off' toggleImageInfo(i) @@ -256,6 +256,7 @@ var toggleInlineImageInfo = createCSSClassToggler('.viewer', // al least at this point... // XXX should we use the createCSSClassToggler for this? // XXX revise: does extra stuff... +/* function toggleImageProportions(mode){ // normal images... var image = $('.image') @@ -298,8 +299,49 @@ function toggleImageProportions(mode){ centerView(null, 'css') } - return 'mode' + return mode } +*/ + +var toggleImageProportions = createCSSClassToggler('.viewer', + [ + 'fit-square', + 'fit-viewer' + ], + function(action){ + var image = $('.image') + var h = image.outerHeight(true) + var w = image.outerWidth(true) + + // viewer proportions... + if(action == 'fit-image-to-viewer'){ + var viewer = $('.viewer') + var W = viewer.innerWidth() + var H = viewer.innerHeight() + + if(W > H){ + image.css('width', W * h/H) + } else { + image.css('height', H * w/W) + } + + // account for rotation... + correctImageProportionsForRotation(image) + centerView(null, 'css') + + // square proportions... + } else { + var size = Math.min(w, h) + image.css({ + width: size, + height: size + }) + + // account for rotation... + correctImageProportionsForRotation(image) + centerView(null, 'css') + } + }) var toggleHelp = makeDrawerToggler(