added an experimental auto enter/exit single image view...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-11-28 05:08:03 +03:00
parent cf02d3c2d5
commit 97b0336ec4
2 changed files with 52 additions and 2 deletions

View File

@ -226,6 +226,9 @@ $(function(){
'ui-animation', 'ui-animation',
'ui-bounds-indicators', 'ui-bounds-indicators',
'ui-current-image-indicator', 'ui-current-image-indicator',
// experimental and optional features...
//'auto-single-image',
]) ])
// this publishes all the actions... // this publishes all the actions...

View File

@ -138,6 +138,7 @@ module.Client =
actions.Actions({ actions.Actions({
config: { config: {
// see .direction for details...
'steps-to-change-direction': 3, 'steps-to-change-direction': 3,
}, },
@ -643,11 +644,17 @@ module.Viewer =
actions.Actions(Client, { actions.Actions(Client, {
config: { config: {
// The maximum screen width allowed when zooming...
'max-screen-images': 30, 'max-screen-images': 30,
// A step (multiplier) used by .zoomIn()/.zoomOut() actions.
// NOTE: this is rounded to the nearest whole screen width in images
// and current fit-overflow added.
'zoom-step': 1.2, 'zoom-step': 1.2,
// added to number of images to fit to indicate scroll ability... // added to odd number of images to fit to indicate scroll ability...
// ...this effectively sets the closest distance an image can be from
// the viewer edge...
'fit-overflow': 0.2, 'fit-overflow': 0.2,
}, },
@ -1019,6 +1026,7 @@ actions.Actions(Client, {
// XXX the question with these is how to make these relatively // XXX the question with these is how to make these relatively
// similar across platforms... // similar across platforms...
// ...for this we need to get display dpi...
fitSmall: ['Show small image', fitSmall: ['Show small image',
function(){ }], function(){ }],
fitNormal: ['Show normal image', fitNormal: ['Show normal image',
@ -1525,7 +1533,7 @@ module.SingleImageView = Feature({
actions: SingleImageActions, actions: SingleImageActions,
handlers:[ handlers:[
['fitImgae.post', ['fitImage.post',
function(){ function(){
// singe image mode -- set image proportions... // singe image mode -- set image proportions...
if(this.toggleSingleImage('?') == 'on'){ if(this.toggleSingleImage('?') == 'on'){
@ -1941,6 +1949,45 @@ module.GlobalStateIndicator = Feature({
//---------------------------------------------------------------------
// XXX experimental...
// ...not sure if this is the right way to go...
// XXX need to get the minimal size and not the width as results will
// depend on viewer format...
var AutoSingleImage =
module.AutoSingleImage = Feature({
title: '',
doc: '',
tag: 'auto-single-image',
config: {
'auto-single-image-in': 2,
'auto-single-image-out': 7,
},
handlers: [
['fitImage.pre',
function(count){
count = count || 1
if(this.toggleSingleImage('?') == 'off'
&& count < this.config['auto-single-image-in']
&& count < this.screenwidth){
this.toggleSingleImage()
} else if(this.toggleSingleImage('?') == 'on'
&& count >= this.config['auto-single-image-out']
&& count > this.screenwidth){
this.toggleSingleImage()
}
}],
],
})
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// XXX should we rename this to "select"??? // XXX should we rename this to "select"???