From 448099d9e724df6ea8c5e12b9b137558b70c4596 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 7 Dec 2016 02:03:10 +0300 Subject: [PATCH] mostly fixed broken drag... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-chrome.js | 6 ++++-- ui (gen4)/features/ui.js | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ui (gen4)/features/ui-chrome.js b/ui (gen4)/features/ui-chrome.js index ec03b304..227833e9 100755 --- a/ui (gen4)/features/ui-chrome.js +++ b/ui (gen4)/features/ui-chrome.js @@ -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 diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 9c02fd96..d11a0862 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -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' }) }