minor tweaking and fixups...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-08 23:11:44 +03:00
parent 04e2665920
commit 07a75228ce

View File

@ -1675,6 +1675,14 @@ module.DirectControlHammer = core.ImageGridFeatures.Feature({
//'ui-partial-ribbons', //'ui-partial-ribbons',
], ],
config: {
// This can be:
// 'silent' - silently focus central image after pan
// true - focus central image after pan
// null - do nothing.
'focus-central-image': 'silent',
},
// XXX add setup/taredown... // XXX add setup/taredown...
// XXX add inertia... // XXX add inertia...
// XXX hide current image indicator on drag... // XXX hide current image indicator on drag...
@ -1682,6 +1690,9 @@ module.DirectControlHammer = core.ImageGridFeatures.Feature({
// XXX add mode switching.... // XXX add mode switching....
handlers: [ handlers: [
// setup ribbon dragging... // setup ribbon dragging...
// XXX it is possible to drag over the loaded ribbon section with
// two fingers, need to force update somehow...
// ...and need to try and make the update in a single frame...
// XXX drag in single image mode ONLY if image is larger than screen... // XXX drag in single image mode ONLY if image is larger than screen...
['updateRibbon', ['updateRibbon',
function(_, target){ function(_, target){
@ -1706,12 +1717,17 @@ module.DirectControlHammer = core.ImageGridFeatures.Feature({
var data = r.data('drag-data') var data = r.data('drag-data')
// we just started...
if(!data){ if(!data){
// hide and remove current image indicator...
// XXX hide current image indicator... var m = that.ribbons.viewer
// ...make sure it shows up on select/navigation... .find('.current-marker')
that.ribbons.viewer.find('.current-marker').hide() .velocity({opacity: 0}, {
duration: 100,
complete: function(){
m.remove()
},
})
var data = { var data = {
left: d.getOffset(this).left left: d.getOffset(this).left
@ -1719,16 +1735,19 @@ module.DirectControlHammer = core.ImageGridFeatures.Feature({
r.data('drag-data', data) r.data('drag-data', data)
} }
// do the actual move...
d.setOffset(this, data.left + (g.deltaX / s)) d.setOffset(this, data.left + (g.deltaX / s))
// when done...
if(g.isFinal){ if(g.isFinal){
r.removeData('drag-data') r.removeData('drag-data')
// XXX this seems to have trouble with off-screen images...
var central = that.ribbons.getImageByPosition('center', r)
// load stuff if needed... // load stuff if needed...
that.updateRibbon( that.updateRibbon(central)
that.ribbons.getImageByPosition('center', r))
// XXX add inertia.... // XXX add inertia....
/* /*
console.log('!!!!', g.velocityX) console.log('!!!!', g.velocityX)
@ -1736,6 +1755,15 @@ module.DirectControlHammer = core.ImageGridFeatures.Feature({
translateX: (data.left + g.deltaX + (g.velocityX * 10)) +'px' translateX: (data.left + g.deltaX + (g.velocityX * 10)) +'px'
}, 'easeInSine') }, 'easeInSine')
*/ */
// silently focus central image...
if(that.config['focus-central-image'] == 'silent'){
that.data.current = that.ribbons.getElemGID(central)
// focus central image in a normal manner...
} else if(that.config['focus-central-image']){
that.focusImage(that.ribbons.getElemGID(central))
}
} }
}) })
} }