fixd some issues with cloning...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-27 18:56:08 +03:00
parent 3cd74e216a
commit f23f226475
3 changed files with 33 additions and 29 deletions

View File

@ -174,8 +174,10 @@ actions.Actions({
}], }],
clear: ['File|Interface/Clear viewer', clear: ['File|Interface/Clear viewer',
function(){ function(){
delete this.data //delete this.data
delete this.images //delete this.images
this.data = null
this.images = null
}], }],
// NOTE: for complete isolation it is best to completely copy the // NOTE: for complete isolation it is best to completely copy the
@ -1069,7 +1071,7 @@ module.Journal = core.ImageGridFeatures.Feature({
function(data){ function(data){
this.journal = (this.hasOwnProperty('journal') this.journal = (this.hasOwnProperty('journal')
|| this.journal) ? || this.journal) ?
this.journal this.journal || []
: [] : []
this.journal.push(data) this.journal.push(data)
}], }],

View File

@ -60,16 +60,16 @@ function(attr, states, a, b){
// Root ImageGrid.viewer object constructor... // Root ImageGrid.viewer object constructor...
// //
var ImageGrid = object.makeConstructor('ImageGrid', actions.MetaActions) var ImageGrid =
module.ImageGrid = object.makeConstructor('ImageGrid', actions.MetaActions)
// Root ImageGrid feature set.... // Root ImageGrid feature set....
var ImageGridFeatures = var ImageGridFeatures =
module.ImageGridFeatures = new features.FeatureSet() module.ImageGridFeatures = new features.FeatureSet()
// setup base instance constructor... // setup base instance constructor...
ImageGridFeatures.__actions__ = function(){ ImageGridFeatures.__actions__ =
return actions.Actions(ImageGrid()) function(){ return actions.Actions(ImageGrid()) }
}

View File

@ -54,51 +54,53 @@ $(function(){
// setup actions... // setup actions...
window.a = viewer.ImageGridFeatures window.ig =
.setup([ window.ImageGrid =
'viewer-testing', viewer.ImageGridFeatures
.setup([
'viewer-testing',
'demo', 'demo',
// XXX this is not for production... // XXX this is not for production...
'experiments', 'experiments',
]) ])
// used to switch experimental actions on (set to true) or off (unset or false)... // used to switch experimental actions on (set to true) or off (unset or false)...
//a.experimental = true //ig.experimental = true
// report stuff... // report stuff...
// XXX we also have .conflicts and .missing // XXX we also have .conflicts and .missing
a.features.excluded.length > 0 ig.features.excluded.length > 0
&& console.warn('Features excluded (%d):', && console.warn('Features excluded (%d):',
a.features.excluded.length, ig.features.excluded.length,
a.features.excluded) ig.features.excluded)
a.features.disabled.length > 0 ig.features.disabled.length > 0
&& console.log('Features disabled (%d):', && console.log('Features disabled (%d):',
a.features.disabled.length, ig.features.disabled.length,
a.features.disabled) ig.features.disabled)
console.log('Features not applicable (%d):', console.log('Features not applicable (%d):',
a.features.unapplicable.length, ig.features.unapplicable.length,
a.features.unapplicable) ig.features.unapplicable)
console.log('Features loaded (%d):', console.log('Features loaded (%d):',
a.features.features.length, ig.features.features.length,
a.features.features) ig.features.features)
a.logger = a.logger || {emit: function(e, v){ console.log(' ', e, v) }} ig.logger = ig.logger || {emit: function(e, v){ console.log(' ', e, v) }}
// setup the viewer... // setup the viewer...
a ig
.load({ viewer: $('.viewer') }) .load({ viewer: $('.viewer') })
.start() .start()
// load some testing data if nothing else loaded... // load some testing data if nothing else loaded...
if(!a.url_history || Object.keys(a.url_history).length == 0){ if(!ig.url_history || Object.keys(ig.url_history).length == 0){
// NOTE: we can (and do) load this in parts... // NOTE: we can (and do) load this in parts...
a.loadDemoIndex() ig.loadDemoIndex()
// 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...