some more tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-04-27 17:46:25 +03:00
parent 7ff46d2b2c
commit 288b72a048

View File

@ -74,17 +74,20 @@ var VirtualDOMRibbonsPrototype = {
// constructors... // constructors...
// XXX get vertical offset and scale... // XXX get vertical offset and scale...
makeView: function(count){ makeView: function(target, count, scale){
var data = imagegrid.data var data = this.imagegrid.data
var images = imagegrid.images var images = this.imagegrid.images
// XXX // XXX calculate count...
var s = 1 count = count || 30
// XXX offset and scale...
var s = scale || this.imagegrid.scale
var x = 0 var x = 0
var ribbons = data.ribbon_order var ribbons = data.ribbon_order
.map(function(gid){ .map(function(gid){
return makeRibbon(gid, data, images, count) }) return this.makeRibbon(gid, count, target) })
return vdom.h('div.ribbon-set', { return vdom.h('div.ribbon-set', {
key: 'ribbon-set', key: 'ribbon-set',
@ -104,22 +107,24 @@ var VirtualDOMRibbonsPrototype = {
// XXX calc/get count if not given explicitly... // XXX calc/get count if not given explicitly...
// XXX calc offset (y)... // XXX calc offset (y)...
// XXX should we setup handlers here??? // XXX should we setup handlers here???
makeRibbon: function(gid, count){ makeRibbon: function(gid, count, target){
var data = imagegrid.data var data = this.imagegrid.data
var images = imagegrid.images var images = this.imagegrid.images
var imgs = [] var imgs = []
// XXX // XXX align via target...
var y = 0 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(this.makeImage(gid))
makeImageMarks(gid, data, images)
this.makeImageMarks(gid)
.forEach(function(mark){ .forEach(function(mark){
imgs.push(mark) }) imgs.push(mark) })
}) })
return vdom.h('div.ribbon', { return vdom.h('div.ribbon', {
key: 'ribbon-'+gid, key: 'ribbon-'+gid,
@ -136,8 +141,8 @@ var VirtualDOMRibbonsPrototype = {
// 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...
makeImage: function(gid){ makeImage: function(gid){
var data = imagegrid.data var data = this.imagegrid.data
var images = imagegrid.images || {} var images = this.imagegrid.images || {}
var image = images[gid] || {} var image = images[gid] || {}
var current = data.current == gid ? '.current' : '' var current = data.current == gid ? '.current' : ''
@ -171,7 +176,7 @@ var VirtualDOMRibbonsPrototype = {
return marks return marks
.map(function(type){ .map(function(type){
return makeImageMark(gid, type, data, images) }) return makeImageMark(gid, type) })
}, },
makeImageMark: function(gid, type){ makeImageMark: function(gid, type){
return vdom.h('div.mark'+(type || ''), { return vdom.h('div.mark'+(type || ''), {