diff --git a/WebApollo/js/Store/SeqFeature/ScratchPad.js b/WebApollo/js/Store/SeqFeature/ScratchPad.js index 6d35619d28..0dd5a9c91c 100644 --- a/WebApollo/js/Store/SeqFeature/ScratchPad.js +++ b/WebApollo/js/Store/SeqFeature/ScratchPad.js @@ -8,14 +8,36 @@ return declare( SeqFeatureStore, { constructor: function( args ) { this.features = {}; + this.sorted_feats = []; this._calculateStats(); }, insert: function( feature ) { this.features[ feature.id() ] = feature; +// this._sort(); this._calculateStats(); }, + replace: function( feature ) { + this.features[ feature.id() ] = feature; +// this._sort(); + this._calculateStats(); + }, + +/* _sort: function() { + sorted_feats.sort(function(a, b) { + var astart = a.get('start'); + var bstart = b.get('start'); + if (astart != bstart) { + return astart - bstart; + } + else { + return b.get('end') - a.get('end'); + } + } ); + }, +*/ + /* delete: function( feature ) { this.deleteFeatureById[ feature.id() ]; @@ -26,6 +48,7 @@ return declare( SeqFeatureStore, delete this.features[ id ]; this._calculateStats(); }, + /* if feature with given id is present in store, return it. Otherwise return null */ getFeatureById: function( id ) { diff --git a/WebApollo/js/View/Track/AnnotTrack.js b/WebApollo/js/View/Track/AnnotTrack.js index a139ce0404..8afc154a46 100644 --- a/WebApollo/js/View/Track/AnnotTrack.js +++ b/WebApollo/js/View/Track/AnnotTrack.js @@ -356,9 +356,14 @@ var AnnotTrack = declare( DraggableFeatureTrack, * received notification from server ChangeNotificationListener that annotations were updated * currently handled as if receiving DELETE followed by ADD command */ - annotationsUpdatedNotification: function(annots) { - this.annotationsDeletedNotification(annots); - this.annotationsAddedNotification(annots); + annotationsUpdatedNotification: function(responseFeatures) { + // this.annotationsDeletedNotification(annots); + // this.annotationsAddedNotification(annots); + for (var i = 0; i < responseFeatures.length; ++i) { + var feat = JSONUtils.createJBrowseFeature( responseFeatures[i] ); + // var id = responseFeatures[i].uniquename; + this.store.replace(feat); + } }, /**