Skip to content
Snippets Groups Projects
Commit b210283d authored by Marcelo Querino Lima Alfonso's avatar Marcelo Querino Lima Alfonso
Browse files

added listening to PDB.ligHeatmap mouseover and mouseout

parent ed3dc5fa
No related branches found
No related tags found
2 merge requests!5Refactored code for diplaying aggregated ligand interactions,!4Added features for aggregated ligand interaction view and interactivity with heat map
......@@ -14,6 +14,9 @@ namespace Config {
export const molstarMouseoverEvent: string = 'PDB.molstar.mouseover';
export const molstarMouseoutEvent: string = 'PDB.molstar.mouseout';
export const ligandHeatmapMouseoverEvent: string = 'PDB.ligHeatmap.mouseover';
export const ligandHeatmapMouseoutEvent: string = 'PDB.ligHeatmap.mouseout';
export const aaTypes = new Map<string, Array<string>>([
['hydrophobic', new Array<string>('A', 'I', 'L', 'M', 'F', 'W', 'V')],
['positive', Array<string>('K', 'R', 'O')],
......
......@@ -308,24 +308,23 @@ class Depiction {
/**
* Mouse enter event handler for circles around atoms
* depicting their weights
* @private
* @public
* @param {Atom} atom object
* @memebrof Depiction
*/
private atomMouseEnterEventHandler(x: Atom){
public atomMouseEnterEventHandler(x: Atom){
this.fireExternalAtomEvent(x, Config.LigandShowAtomEvent);
}
/**
* Mouse leave event handler for circlea round atoms
* depicting their weights
* @private
* @public
* @memberof Depiction
*/
private atomMouseLeaveEventHandler(){
public atomMouseLeaveEventHandler(){
this.fireExternalNullEvent(Config.LigandHideAtomEvent);
}
// #endregion
......
......@@ -79,8 +79,11 @@ class Visualization {
if (uiParameters.zoom) this.zoomHandler = this.getZoomHandler();
document.addEventListener(Config.ligandHeatmapMouseoverEvent, e => this.ligHeatmapMouseoverEventHandler(e));
document.addEventListener(Config.ligandHeatmapMouseoutEvent, () => this.ligHeatmapMouseoutEventHandler());
document.addEventListener(Config.molstarClickEvent, e => this.molstarClickEventHandler(e));
document.addEventListener(Config.molstarMouseoverEvent, e => this.molstarClickEventHandler(e));
document.addEventListener(Config.molstarMouseoverEvent, e => this.molstarClickEventHandler(e));
document.addEventListener(Config.molstarMouseoutEvent, () => this.molstarMouseoutEventHandler());
d3.select(this.parent).on('resize', () => this.resize());
......@@ -106,7 +109,7 @@ class Visualization {
private molstarClickEventHandler(e: any) {
if (this.fullScreen) return;
let hash = `${e.eventData.auth_asym_id}${e.eventData.auth_seq_id}${e.eventData.ins_code}`;
let hash = `${e.eventData.auth_asym_id}${e.eventData.auth_seq_id}${e.eventData.ins_code}`;
this.nodes?.each((node: Model.InteractionNode, index: number, group: any) => {
this.nodeDim(node, index, group);
......@@ -120,6 +123,18 @@ class Visualization {
}
private ligHeatmapMouseoverEventHandler(e: any) {
const atomName = e.detail.name; // CustomEvent
const atom = this.depiction.atoms.filter(x => x.value >0 && x.name === atomName);
if (atom.length > 0) {
this.depiction.atomMouseEnterEventHandler(atom[0]);
}
}
private ligHeatmapMouseoutEventHandler() {
this.depiction.atomMouseLeaveEventHandler();
}
/**
* Handles mouse leave molstar event. Removes interaction node highlight
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment