Skip to content

Commit

Permalink
Partial fix for WebApollo issue #13, where annotation editing causes …
Browse files Browse the repository at this point in the history
…unexpected layout change (when there are overlapping annotations), making it appear like edits were actually done on a different annotation.
  • Loading branch information
gregg committed Dec 3, 2012
1 parent 5bb9a53 commit 5c4eb98
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
23 changes: 23 additions & 0 deletions WebApollo/js/Store/SeqFeature/ScratchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() ];
Expand All @@ -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 ) {
Expand Down
11 changes: 8 additions & 3 deletions WebApollo/js/View/Track/AnnotTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},

/**
Expand Down

0 comments on commit 5c4eb98

Please sign in to comment.