mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-18 17:21:39 +00:00
some minor refactoring + bugfix: now .fitRibbon(..) also triggers partial image loading...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b88be66316
commit
73b407fcfa
@ -219,6 +219,15 @@ module.RibbonsPrototype = {
|
|||||||
|
|
||||||
return W/w
|
return W/w
|
||||||
},
|
},
|
||||||
|
// XXX this does not account for ribbon spacing...
|
||||||
|
getScreenHeightRibbons: function(scale){
|
||||||
|
var scale = scale == null ? 1 : scale/this.getScale()
|
||||||
|
|
||||||
|
var H = this.viewer.height()
|
||||||
|
var h = this.getVisibleImageSize('height') * scale
|
||||||
|
|
||||||
|
return H/h
|
||||||
|
},
|
||||||
|
|
||||||
// Get ribbon set scale...
|
// Get ribbon set scale...
|
||||||
//
|
//
|
||||||
@ -1606,8 +1615,7 @@ module.RibbonsPrototype = {
|
|||||||
n = n || 1
|
n = n || 1
|
||||||
fit_whole_images = fit_whole_images == null ? true : false
|
fit_whole_images = fit_whole_images == null ? true : false
|
||||||
|
|
||||||
var h = this.getVisibleImageSize('height', 1)
|
var scale = this.getScreenHeightRibbons(1) / n
|
||||||
var scale = this.viewer.height() / (h * n)
|
|
||||||
|
|
||||||
var w = this.getVisibleImageSize('width', 1)
|
var w = this.getVisibleImageSize('width', 1)
|
||||||
var W = this.viewer.width()
|
var W = this.viewer.width()
|
||||||
|
|||||||
@ -607,9 +607,12 @@ actions.Actions(Client, {
|
|||||||
: data.getImage(target)
|
: data.getImage(target)
|
||||||
|
|
||||||
// align current ribbon...
|
// align current ribbon...
|
||||||
|
// NOTE: the ordering of calls here makes it simpler to load
|
||||||
|
// data into ribbons based on target gid... i.e. first
|
||||||
|
// we know the section we need then align it vertically...
|
||||||
this
|
this
|
||||||
.centerRibbon(gid)
|
|
||||||
.centerImage(gid)
|
.centerImage(gid)
|
||||||
|
.centerRibbon(gid)
|
||||||
|
|
||||||
// align other ribbons...
|
// align other ribbons...
|
||||||
var ribbon = data.getRibbon(gid)
|
var ribbon = data.getRibbon(gid)
|
||||||
@ -1012,6 +1015,21 @@ module.PartialRibbons = Feature({
|
|||||||
.on('fitImage.pre', this.tag, function(n){
|
.on('fitImage.pre', this.tag, function(n){
|
||||||
this.updateRibbonSize('current', n || 1)
|
this.updateRibbonSize('current', n || 1)
|
||||||
})
|
})
|
||||||
|
.on('fitRibbon.pre', this.tag, function(n){
|
||||||
|
n = n || 1
|
||||||
|
|
||||||
|
// convert target height in ribbons to width in images...
|
||||||
|
// NOTE: this does not account for compensation that
|
||||||
|
// .updateRibbonSize(..) makes for fitting whole image
|
||||||
|
// counts, this is a small enough error so as not
|
||||||
|
// to waste time on...
|
||||||
|
var s = this.ribbons.getScale()
|
||||||
|
var h = this.ribbons.getScreenHeightRibbons()
|
||||||
|
var w = this.ribbons.getScreenWidthImages()
|
||||||
|
var nw = w / (h/n)
|
||||||
|
|
||||||
|
this.updateRibbonSize('current', nw)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
remove: function(actions){
|
remove: function(actions){
|
||||||
actions.mixout(PartialRibbonsActions)
|
actions.mixout(PartialRibbonsActions)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user