Commit 248eddb6 authored by Lukas Pravda's avatar Lukas Pravda
Browse files

code polish

parent 85fbacc3
......@@ -66,7 +66,7 @@ class Visualization {
this.nodesRoot = this.canvas.append('g').attr('id', 'nodes');
if (uiParameters.zoom) this.zoomHandler = this.getZoomHandler();
document.addEventListener(Config.molstarClickEvent, e => this.molstarClickEventHandler(e));
document.addEventListener(Config.molstarMouseoverEvent, e => this.molstarClickEventHandler(e));
document.addEventListener(Config.molstarMouseoutEvent, () => this.molstarMouseoutEventHandler());
......@@ -212,7 +212,7 @@ class Visualization {
let url = Resources.carbohydratePolymerAPI(pdbid, bmId, entityId, this.environment);
d3.json(url)
.catch(e => this.processError(e, 'No interactions to display'))
.catch(e => this.processError(e, 'No interactions data are available.'))
.then((data: any) => this.addBoundMoleculeInteractions(data, bmId))
.then(() => new Promise(resolve => setTimeout(resolve, 1500)))
.then(() => this.centerScene());
......@@ -385,7 +385,7 @@ class Visualization {
let dataBlob = new Blob([JSON.stringify(this.interactionsData, null, 4)], { type: 'application/json' });
downloadLink.href = URL.createObjectURL(dataBlob);
downloadLink.download = this.interactionsData === undefined ? 'no name.json' : `${this.pdbId}_${this.presentBindingSite.bmId}_interactions.json`;
downloadLink.download = this.interactionsData === undefined ? 'no_name.json' : `${this.pdbId}_${this.presentBindingSite.bmId}_interactions.json`;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
......@@ -452,8 +452,8 @@ class Visualization {
private computeBoundingBox(minX: number, maxX: number, minY: number, maxY: number) {
// The width and the height of the graph
let molWidth = maxX - minX;
let molHeight = maxY - minY;
let molWidth = (maxX - minX) + 1; // +1 to avoid 0 division
let molHeight = (maxY - minY) + 1;
// how much larger the drawing area is than the width and the height
let widthRatio = this.parent.offsetWidth / molWidth;
......@@ -479,8 +479,7 @@ class Visualization {
let translation = d3.zoomIdentity.translate(xTrans, yTrans).scale(minRatio);
this.zoomHandler?.transform(this.svg, translation);
};
}
// #endregion menu functions
......@@ -805,8 +804,7 @@ class Visualization {
.on('tick', () => this.simulationStep());
this.dragHandler(this.nodes);
if (this.zoomHandler) this.zoomHandler(this.svg);
if (this.zoomHandler !== undefined) this.zoomHandler(this.svg, d3.zoomIdentity);
}
......
......@@ -370,8 +370,7 @@ namespace Model {
let bgnNode = this.processResidueInteractionPartner(x.begin);
let endNode = this.processResidueInteractionPartner(x.end);
let link = new ResidueResidueLink(bgnNode, endNode, x.interactions)
let link = new ResidueResidueLink(bgnNode, endNode, x.interactions);
this.links.push(link);
});
......
Markdown is supported
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