brute-force killed a bug with toggleImageProportions(...), fixed a trailing '//////' explosion in BASE_URL, minor tweaks and fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-09 02:26:22 +04:00
parent 6bd8782a21
commit 8159a27407
7 changed files with 37 additions and 17 deletions

View File

@ -90,8 +90,11 @@ Roadmap
[_] 24% Gen 3 current todo
[_] 49% High priority
[_] 26% Gen 3 current todo
[_] 53% High priority
BUG: scaling is again broken with rotated images
| - rotate an image
| - scale it to 1 (press 1)
[_] ASAP: directory selector UI...
[_] usable empty view -- w.o. data...
[_] 0% Tablet UI
@ -218,9 +221,6 @@ Roadmap
[X] image info
[X] stub info dialog
[_] detailed image info
[_] 0% gesture support
[_] up/down - shift
[_] left/right - navigate
[_] 0% CSS
[_] cleanup
[_] split themes and layout
@ -236,9 +236,11 @@ Roadmap
[_] caching config
[_] BUG: jumping screen images does not load the adjacent ribbons...
| positioning is OK but ribbons are not fully visible...
[_] BUG: BASE_URL seems to gain a new trailing '/' on each save...
[X] BUG: BASE_URL seems to gain a new trailing '/' on each save...
| low priority as this does not affect anything...
[_] start/stop gif animations...
[X] 100% gesture support
[X] up/down - navigate
[X] left/right - navigate
[X] make the marks in single image mode show in corner of viewer, not image
| and think of a uniform indicator position...
|

View File

@ -982,11 +982,14 @@ function resetToOriginalImage(image){
/********************************************************* Zooming ***/
function fitNImages(n, fixed_proportions){
var viewer = $('.viewer')
viewer.trigger('preFittingImages', [n])
var image = getImage()
var w = image.outerWidth(true)
var h = image.outerHeight(true)
var viewer = $('.viewer')
var W = viewer.innerWidth()
var H = viewer.innerHeight()

View File

@ -401,6 +401,7 @@ Array.prototype.binSearch = function(target, cmp, get){
// NOTE: changing a base URL will trigger a baseURLChanged event...
function setBaseURL(url){
var old_url = BASE_URL
url = url.replace(/\/*$/, '/')
BASE_URL = url
$('.viewer').trigger('baseURLChanged', [old_url, url])
}

View File

@ -424,6 +424,8 @@ var KEYBOARD_CONFIG = {
// zooming...
'#1': doc('Fit image', function(){ fitNImages(1) }),
'-': doc('Zoom in', function(){ zoomOut() }),
'=': doc('Zoom out', function(){ zoomIn() }),

View File

@ -104,6 +104,7 @@ function saveLocalStorageSettings(attr){
function loadLocalStorage(attr){
attr = attr == null ? DATA_ATTR : attr
var d = loadLocalStorageData(attr)
loadLocalStorageBaseURLHistory(attr)
setBaseURL(d.base_url)
DATA = d.data
IMAGES = loadLocalStorageImages(attr)
@ -113,6 +114,7 @@ function saveLocalStorage(attr){
attr = attr == null ? DATA_ATTR : attr
saveLocalStorageData(attr)
saveLocalStorageImages(attr)
saveLocalStorageBaseURLHistory()
}

View File

@ -120,7 +120,7 @@ var toggleSingleImageMode = createCSSClassToggler(
'.viewer',
'single-image-mode',
function(action){
// prevent reiniting...
// prevent reentering...
if(action == toggleSingleImageMode('?')){
return false
}
@ -265,12 +265,21 @@ var toggleImageProportions = createCSSClassToggler(
'none',
'fit-viewer'
],
function(action){
// prevent reentering...
if(action == toggleImageProportions('?')){
return false
}
},
function(action){
var image = $('.image')
var h = image.outerHeight(true)
var w = image.outerWidth(true)
// viewer proportions...
// XXX going into here twice for a rotated 90/270 image will
// set it back to square...
// ...can't even begin to imagine what can affect this!
if(action == 'fit-viewer'){
var viewer = $('.viewer')
var W = viewer.innerWidth()

View File

@ -149,7 +149,6 @@ function setupDataBindings(viewer){
rollImages(gr.length, ribbon)
})
.on('fittingImages', function(evt, n){
// load correct amount of images in each ribbon!!!
var screen_size = getScreenWidthInImages()
@ -168,16 +167,18 @@ function setupDataBindings(viewer){
}
// update proportions...
// XXX for some magical reason this is stable for un-rotated
// images and does mad things for rotate 90/270 images...
// ...the only thing that is
if(window.PROPORTIONS_RATIO_THRESHOLD != null
&& toggleSingleImageMode('?') == 'on'){
var viewer = $('.viewer')
//var w = getVisibleImageSize('width')
var h = getVisibleImageSize('height')
//var W = viewer.innerWidth()
var H = viewer.innerHeight()
//var m = Math.min(W/w, H/h)
var m = H/h
var h = getVisibleImageSize('height')
var w = getVisibleImageSize('width')
var H = $('.viewer').innerHeight()
var W = $('.viewer').innerWidth()
var m = Math.min(W/w, H/h)
if(m < PROPORTIONS_RATIO_THRESHOLD){
toggleImageProportions('fit-viewer')