mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
experementing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
67fb0db945
commit
273c053f10
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
var vdom = require('ext-lib/virtual-dom')
|
var vdom = require('ext-lib/virtual-dom')
|
||||||
|
|
||||||
|
var object = require('lib/object')
|
||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
var features = require('lib/features')
|
var features = require('lib/features')
|
||||||
|
|
||||||
@ -60,10 +61,19 @@ VALUE.prototype.hook = function(elem, prop){
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// XXX need a way to link this to the context...
|
||||||
|
var VirtualDOMRibbonsPrototype = {
|
||||||
|
|
||||||
|
virtualdom: null,
|
||||||
|
// XXX this is a circular ref -- I do not like it...
|
||||||
|
imagegrid: null,
|
||||||
|
|
||||||
|
// constructors...
|
||||||
// XXX get vertical offset and scale...
|
// XXX get vertical offset and scale...
|
||||||
var makeView =
|
makeView: function(count){
|
||||||
window.makeView =
|
var data = imagegrid.data
|
||||||
function(data, images, count){
|
var images = imagegrid.images
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
var s = 1
|
var s = 1
|
||||||
var x = 0
|
var x = 0
|
||||||
@ -86,15 +96,19 @@ function(data, images, count){
|
|||||||
},
|
},
|
||||||
ribbons)
|
ribbons)
|
||||||
])
|
])
|
||||||
}
|
},
|
||||||
|
// XXX calc/get count if not given explicitly...
|
||||||
|
// XXX calc offset (y)...
|
||||||
|
// XXX should we setup handlers here???
|
||||||
|
makeRibbon: function(gid, count){
|
||||||
|
var data = imagegrid.data
|
||||||
|
var images = imagegrid.images
|
||||||
|
|
||||||
|
|
||||||
// XXX calc/get count...
|
|
||||||
var makeRibbon =
|
|
||||||
window.makeRibbon =
|
|
||||||
function(gid, data, images, count){
|
|
||||||
var imgs = []
|
var imgs = []
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
var y = 0
|
||||||
|
|
||||||
data.getImages(gid, count, 'total')
|
data.getImages(gid, count, 'total')
|
||||||
.forEach(function(gid){
|
.forEach(function(gid){
|
||||||
imgs.push(makeImage(gid, data, images))
|
imgs.push(makeImage(gid, data, images))
|
||||||
@ -106,17 +120,22 @@ function(gid, data, images, count){
|
|||||||
key: 'ribbon-'+gid,
|
key: 'ribbon-'+gid,
|
||||||
|
|
||||||
gid: new GID(gid),
|
gid: new GID(gid),
|
||||||
|
|
||||||
|
// XXX events, hammer, ...???
|
||||||
|
|
||||||
|
style: {
|
||||||
|
transform: 'translate3d('+ y +'px, 0px, 0px)',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
imgs)
|
imgs)
|
||||||
}
|
},
|
||||||
|
|
||||||
|
|
||||||
// XXX handle previews -- hook???
|
// XXX handle previews -- hook???
|
||||||
// NOTE: at this point this does not account for previews at all...
|
// NOTE: at this point this does not account for previews at all...
|
||||||
var makeImage =
|
makeImage: function(gid){
|
||||||
window.makeImage =
|
var data = imagegrid.data
|
||||||
function(gid, data, images){
|
var images = imagegrid.images || {}
|
||||||
var image = (images || {})[gid] || {}
|
|
||||||
|
var image = images[gid] || {}
|
||||||
var current = data.current == gid ? '.current' : ''
|
var current = data.current == gid ? '.current' : ''
|
||||||
|
|
||||||
// XXX stuff needed to get a preview:
|
// XXX stuff needed to get a preview:
|
||||||
@ -140,29 +159,33 @@ function(gid, data, images){
|
|||||||
// backgroundImage: 'url('+ url +')',
|
// backgroundImage: 'url('+ url +')',
|
||||||
//}
|
//}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
// XXX get marks...
|
// XXX get marks...
|
||||||
var makeImageMarks =
|
makeImageMarks: function(gid){
|
||||||
window.makeImageMarks =
|
|
||||||
function(gid, data, images){
|
|
||||||
// XXX get marks...
|
// XXX get marks...
|
||||||
var marks = []
|
var marks = []
|
||||||
|
|
||||||
return marks
|
return marks
|
||||||
.map(function(type){
|
.map(function(type){
|
||||||
return makeImageMark(gid, type, data, images) })
|
return makeImageMark(gid, type, data, images) })
|
||||||
}
|
},
|
||||||
|
makeImageMark: function(gid, type){
|
||||||
var makeImageMark =
|
|
||||||
window.makeImageMark =
|
|
||||||
function(gid, type, data, images){
|
|
||||||
return vdom.h('div.mark'+(type || ''), {
|
return vdom.h('div.mark'+(type || ''), {
|
||||||
key: 'mark-'+gid,
|
key: 'mark-'+gid,
|
||||||
gid: new GID(gid),
|
gid: new GID(gid),
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
__init__: function(imagegrid){
|
||||||
|
this.imagegrid = imagegrid
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var VirtualDOMRibbons =
|
||||||
|
module.VirtualDOMRibbons =
|
||||||
|
object.makeConstructor('VirtualDOMRibbons', VirtualDOMRibbonsPrototype)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@ -192,6 +215,10 @@ var PartialRibbonsActions = actions.Actions({
|
|||||||
'ribbon-update-timeout': 120,
|
'ribbon-update-timeout': 120,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get virtualdom(){
|
||||||
|
return (this.__virtual_dom = this.__virtual_dom || VirtualDOMRibbons(this)) },
|
||||||
|
|
||||||
|
|
||||||
updateRibbon: ['- Interface/Update partial ribbon size',
|
updateRibbon: ['- Interface/Update partial ribbon size',
|
||||||
function(target, w, size, threshold, preload){
|
function(target, w, size, threshold, preload){
|
||||||
target = target instanceof jQuery
|
target = target instanceof jQuery
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user