some refactoring and bug fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-11-03 03:01:51 +03:00
parent 2240025747
commit 50bd9d2b45
5 changed files with 19 additions and 5 deletions

View File

@ -546,6 +546,10 @@ var DataPrototype = {
// XXX most of the complexity here comes from argument DSL parsing, // XXX most of the complexity here comes from argument DSL parsing,
// might be good to revise argument syntax and handling... // might be good to revise argument syntax and handling...
getImage: function(target, mode, list){ getImage: function(target, mode, list){
// empty data...
if(this.order == null || (this.order && this.order.length == 0)){
return null
}
// no args... // no args...
if(target == null && mode == null && list == null){ if(target == null && mode == null && list == null){
return this.current return this.current

View File

@ -81,6 +81,7 @@ var RibbonsClassPrototype = {
}, },
// XXX NOTE: quots removal might render this incompatible with older data formats... // XXX NOTE: quots removal might render this incompatible with older data formats...
createRibbon: function(gids){ createRibbon: function(gids){
gids = gids || []
gids = gids.constructor !== Array ? [gids] : gids gids = gids.constructor !== Array ? [gids] : gids
var that = this var that = this
return $(gids.map(function(gid){ return $(gids.map(function(gid){
@ -91,6 +92,7 @@ var RibbonsClassPrototype = {
}, },
// XXX NOTE: quots removal might render this incompatible with older data formats... // XXX NOTE: quots removal might render this incompatible with older data formats...
createImage: function(gids){ createImage: function(gids){
gids = gids || []
gids = gids.constructor !== Array ? [gids] : gids gids = gids.constructor !== Array ? [gids] : gids
var that = this var that = this
return $(gids.map(function(gid){ return $(gids.map(function(gid){

View File

@ -100,7 +100,6 @@ module.setupActions = function(viewer){
viewer = viewer == null ? $('.viewer') : viewer viewer = viewer == null ? $('.viewer') : viewer
//r = r == null ? makeTestRibbons(viewer, images) : r //r = r == null ? makeTestRibbons(viewer, images) : r
//var vv = Object.create(v.Viewer)
var vv = Object.create(v.Client) var vv = Object.create(v.Client)
// XXX need to automate this... // XXX need to automate this...

View File

@ -246,6 +246,7 @@ $(function(){
// used switch experimental actions on (set to true) or off (unset or false)... // used switch experimental actions on (set to true) or off (unset or false)...
//a.experimental = true //a.experimental = true
// setup actions...
viewer.ImageGridFeatures.setup(a, [ viewer.ImageGridFeatures.setup(a, [
'viewer-testing', 'viewer-testing',
@ -256,15 +257,20 @@ $(function(){
// this publishes all the actions... // this publishes all the actions...
//module.GLOBAL_KEYBOARD.__proto__ = a //module.GLOBAL_KEYBOARD.__proto__ = a
// setup the viewer...
a.load({
viewer: $('.viewer'),
})
// load some testing data... // load some testing data...
// NOTE: we can load this in parts... // NOTE: we can load this in parts...
a a
.setEmptyMsg('Loading...')
.load({ .load({
viewer: $('.viewer'),
data: data.Data(testing.mock_data), data: data.Data(testing.mock_data),
images: testing.makeTestImages(), images: testing.makeTestImages(),
}) })
.setEmptyMsg('Loading...')
// this is needed when loading legacy sources that do not have tags // this is needed when loading legacy sources that do not have tags
// synced... // synced...
// do not do for actual data... // do not do for actual data...

View File

@ -793,7 +793,6 @@ module.ImageGridFeatures = Object.create(features.FeatureSet)
var ViewerActions = var ViewerActions =
module.ViewerActions = module.ViewerActions =
//actions.Actions(Client, {
actions.Actions({ actions.Actions({
/* /*
@ -1528,6 +1527,10 @@ var PartialRibbonsActions = actions.Actions({
// the target might not be loaded... // the target might not be loaded...
var r_gid = data.getRibbon(target) var r_gid = data.getRibbon(target)
if(r_gid == null){
return
}
// localize transition prevention... // localize transition prevention...
// NOTE: for the initial load this may be empty... // NOTE: for the initial load this may be empty...
var r = ribbons.getRibbon(r_gid) var r = ribbons.getRibbon(r_gid)
@ -1535,7 +1538,7 @@ var PartialRibbonsActions = actions.Actions({
// XXX do we need to for example ignore unloaded (r.length == 0) // XXX do we need to for example ignore unloaded (r.length == 0)
// ribbons here, for example not load ribbons too far off // ribbons here, for example not load ribbons too far off
// screen?? // screen??
ribbons ribbons
.preventTransitions(r) .preventTransitions(r)
.updateRibbon( .updateRibbon(