-
Notifications
You must be signed in to change notification settings - Fork 1
Panel Events
The following listeners can be added to the panel:-
- panel_empty
- track_added
- track_removed
- view_changed
- feature_clicked
- feature_over
- range_selected
A listener can be added to a panel using the addListener(type, function,[id])
. If no id is supplied than an id will be automatically assigned. The id is returned and can be used to remove the listener removeListener(id)
Called when browser updates to a new location, receives chr, start and finish. e.g to keep panel 2 in synch with panel 1. See example 3
panel.addListener("view_changed",
function(chr,start,end){
panel2.update(chr,start,end,false);
});
Called when a feature is clicked. The panel should be able to accept user clicks either in the initial panel config allow_user_feature_click:true
or using the allowUserFeatureClick()
method. The listener sends the track object, the feature clicked and the original event to the handling function. see example 4
panel.allowUserFeatureClick()
panel.addListener("feature_clicked",
function(track,feature,event){
if (track.config.track_id==="my_track"){
console.log(feature.name +" was clicked");
}
});
Called when the mouse hovers over a feature. The panel should be able to accept mouse over events either in the initial panel config allow_user_feature_over:true
or using the allowFeatureClick()
method. The listener sends the track object, the feature over and the original event
panel.allowUserFeatureOver()
panel.addListener("feature_over",
function(track,feature,event){
if (track.config.track_id==="my_track"){
console.log("mouse over "+feature.name);
}
});
see example 11
Called when a user selects a genomic range (by pressing shift and dragging the mouse) The panel should be able to accept such events either in the initial panel config allow_user_range_selection:true
or using the allowUserRangeSelection()
method. The listener sends chromosome,start and end of the region selected
panel.allowUserRangeSelection();
panel.addListener("range_selected",
function(chr,start,end){
console.log("you selected from "+start+" to "+end);
});
Called when a track is removed from the panel. The listener sends the config of the track that was removed
panel.addListener("track_removed",
function(config){
console.log("The track "+config.short_name+" has been removed");
});