mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
some cleanup and minor stuff...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f0a3aa3d20
commit
d3dc661868
@ -209,6 +209,7 @@ function relativeVisualPosition(outer, inner){
|
||||
}
|
||||
|
||||
// This appears to work well with scaling...
|
||||
// XXX make this more configurable...
|
||||
function centerImage(image, mode){
|
||||
if(mode == null){
|
||||
//mode = 'css'
|
||||
@ -218,14 +219,15 @@ function centerImage(image, mode){
|
||||
image = $('.current.image')
|
||||
}
|
||||
var viewer = $('.viewer')
|
||||
// XXX should these be "inner"???
|
||||
var W = viewer.innerWidth()
|
||||
var H = viewer.innerHeight()
|
||||
|
||||
var ribbons = $('.ribbon-set')
|
||||
var scale = getElementScale(ribbons)
|
||||
// NOTE: these are scalable, this need to get normalized...
|
||||
var w = image.width()*scale
|
||||
var h = image.height()*scale
|
||||
var w = image.outerWidth()*scale
|
||||
var h = image.outerHeight()*scale
|
||||
|
||||
var pos = relativeVisualPosition(viewer, image)
|
||||
|
||||
@ -242,6 +244,20 @@ function centerImage(image, mode){
|
||||
})
|
||||
}
|
||||
|
||||
function fitNImages(n){
|
||||
var image = $('.current.image')
|
||||
var size = image.outerHeight(true)
|
||||
|
||||
var viewer = $('.viewer')
|
||||
var W = viewer.innerWidth()
|
||||
var H = viewer.innerHeight()
|
||||
|
||||
var scale = Math.min(W / (size * n), H / size)
|
||||
|
||||
setElementScale($('.ribbon-set'), scale)
|
||||
centerImage(image, 'css')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -253,6 +269,9 @@ function clickHandler(evt){
|
||||
focusImage(img))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// setup...
|
||||
$(function(){
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user