mostly fixed broken drag...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-12-07 02:03:10 +03:00
parent 9fceef362d
commit 448099d9e7
2 changed files with 16 additions and 8 deletions

View File

@ -165,6 +165,7 @@ var CurrentImageIndicatorActions = actions.Actions({
updateCurrentImageIndicator: ['- Interface/Update current image indicator',
function(target, update_border, scale){
var ribbon_set = this.ribbons.getRibbonSet()
var locator = this.ribbons.getRibbonLocator()
if(ribbon_set.length == 0){
return
@ -303,17 +304,18 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
// only on next/prev screen)...
// ...still not sure why .preventTransitions(m) did not
// do the job.
//
// XXX BUG: sometimes this is out of sync with ribbon update resulting
// in the marker positioned in the wrong spot...
['resizeRibbon.pre',
function(target, s){
var m = this.ribbons.viewer.find('.current-marker')
// only update if marker exists and we are in current ribbon...
if(m.length != 0 && this.currentRibbon == this.data.getRibbon(target)){
//this.ribbons.preventTransitions(m)
m.hide()
return function(){
this.updateCurrentImageIndicator(target, false)
//this.ribbons.restoreTransitions(m, true)
m
.show()
// NOTE: keeping display in inline style will

View File

@ -2043,6 +2043,7 @@ var ControlActions = actions.Actions({
var d = that.ribbons.dom
var g = evt.gesture
var s = that.scale
var vmin = Math.min(document.body.offsetWidth, document.body.offsetHeight)
// we just started...
if(!data){
@ -2055,7 +2056,7 @@ var ControlActions = actions.Actions({
// store initial position...
data = {
//left: d.getOffset(this).left,
left: $(this).transform('x'),
left: parseFloat(($(this).transform('translate3d') || [0])[0])/100 * vmin,
pointers: g.pointers.length,
}
@ -2072,14 +2073,15 @@ var ControlActions = actions.Actions({
// queue a render...
render_data[rgid] = {
ribbon: r,
x: data.left + (g.deltaX / s),
x: ((data.left + (g.deltaX / s)) / vmin * 100) + 'vmin',
}
// inline render...
} else {
// do the actual move...
//d.setOffset(this, data.left + (g.deltaX / s))
r.transform({x: data.left + (g.deltaX / s)})
r.transform({
x: ((data.left + (g.deltaX / s)) / vmin * 100) + 'vmin',
})
/* XXX this seems to offer no speed advantages
* vs. .setOffset(..) but does not play
@ -2134,13 +2136,17 @@ var ControlActions = actions.Actions({
// partly out the left -- show last image...
} else if(cl < 0){
r.transform({
x: r.transform('x') - (cl / s)
x: (parseFloat((r.transform('translate3d') || [0])[0])
- ((cl / s) / vmin * 100)) + 'vmin'
})
// partly out the right -- show first image...
} else if(cl + (w*s) > W){
r.transform({
x: r.transform('x') + (W - (cl + w*s)) / s
//x: r.transform('x') + (W - (cl + w*s)) / s
// XXX use vmin...
x: (parseFloat((r.transform('translate3d') || [0])[0])
+ (((W - (cl + w*s)) / s) / vmin * 100)) + 'vmin'
})
}