mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 20:00:10 +00:00
fixed several viewer offset dependencies...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
63dfd6dbac
commit
120b7a43bb
@ -294,6 +294,8 @@ module.RibbonsPrototype = {
|
|||||||
var s = this.getScale()
|
var s = this.getScale()
|
||||||
|
|
||||||
if(a != null && b != null){
|
if(a != null && b != null){
|
||||||
|
var vo = this.viewer.offset()
|
||||||
|
|
||||||
a = a == 'left' ? 0
|
a = a == 'left' ? 0
|
||||||
: a == 'right' ? this.viewer.width()
|
: a == 'right' ? this.viewer.width()
|
||||||
: a == 'center' ? this.viewer.width()/2
|
: a == 'center' ? this.viewer.width()/2
|
||||||
@ -306,8 +308,8 @@ module.RibbonsPrototype = {
|
|||||||
: /[0-9.]*%/.test(b) ? this.viewer.height()*(parseFloat(b)/100)
|
: /[0-9.]*%/.test(b) ? this.viewer.height()*(parseFloat(b)/100)
|
||||||
: b
|
: b
|
||||||
|
|
||||||
var l = (a - ro.left)/s
|
var l = (a - ro.left)/s + vo.left
|
||||||
var t = (b - ro.top)/s
|
var t = (b - ro.top)/s + vo.top
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var img = this.getImage(a)
|
var img = this.getImage(a)
|
||||||
@ -1458,16 +1460,16 @@ module.RibbonsPrototype = {
|
|||||||
// center an image horizontally...
|
// center an image horizontally...
|
||||||
//
|
//
|
||||||
// XXX offset is not used...
|
// XXX offset is not used...
|
||||||
// XXX custom align point woud also be nice...
|
// XXX custom align point would also be nice...
|
||||||
// (top, bottom, center, %, px)
|
// (top, bottom, center, %, px)
|
||||||
centerImage: function(target, mode, offset, scale){
|
centerImage: function(target, mode, offset, scale){
|
||||||
target = this.getImage(target)
|
target = this.getImage(target)
|
||||||
scale = scale || this.getScale()
|
scale = scale || this.getScale()
|
||||||
var ribbon = this.getRibbon(target)
|
var ribbon = this.getRibbon(target)
|
||||||
|
|
||||||
var vl = this.viewer.offset().left
|
|
||||||
var rl = ribbon.offset().left
|
var rl = ribbon.offset().left
|
||||||
var il = target.offset().left
|
var il = target.offset().left
|
||||||
|
//var rsl = this.viewer.find('.ribbon-set').offset().left
|
||||||
var W = this.viewer.width() * scale
|
var W = this.viewer.width() * scale
|
||||||
var w = target.width() * scale
|
var w = target.width() * scale
|
||||||
|
|
||||||
@ -1477,7 +1479,7 @@ module.RibbonsPrototype = {
|
|||||||
|
|
||||||
ribbon
|
ribbon
|
||||||
.css({
|
.css({
|
||||||
left: (rl + ((W-w)/2 + image_offset) - (il - vl)) / scale,
|
left: (rl + ((W-w)/2 + image_offset) - il) / scale,
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user