Skip to content

Commit

Permalink
fix for collapsing proteins from table (keep them on screen)
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-combe committed Oct 19, 2021
1 parent 78432c5 commit 4b603dc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/complexviewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "complexviewer",
"version": "2.1.15",
"version": "2.1.16",
"description": "A network visualisation that displays molecular interaction data, including detailed residue-level information such as binding sites. Used in EBI's Complex Portal and elsewhere.",
"author": {
"name": "Colin Combe",
Expand Down
2 changes: 1 addition & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class App {

collapseProtein() {
d3.select(".custom-menu-margin").style("display", "none");
this.contextMenuProt.setExpanded(false, this.contextMenuPoint);
this.contextMenuProt.setExpanded(false);//, this.contextMenuPoint);
this.contextMenuProt = null;
this.notifyExpandListeners();
}
Expand Down
6 changes: 5 additions & 1 deletion src/js/viz/interactor/interactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ export class Interactor {
//remember previous position
this.px = this.x;
this.py = this.y;

let xOffset = (this.width / 2 - (this.getSymbolRadius()));
/*
// let xOffset = (15 + this.labelSVG.getComputedTextLength()) / 2;
// would also work because
// width = (2 * this.getSymbolRadius()) + 15 + this.labelSVG.getComputedTextLength();
*/
if (this.expanded) {
xOffset = xOffset - (this.size / 2 * this.stickZoom);
}
Expand Down
15 changes: 15 additions & 0 deletions src/js/viz/interactor/polymer.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ export class Polymer extends Interactor {
}

toCircle(transition = true, svgP) {

if (!svgP) {
const width = this.app.svgElement.parentNode.clientWidth;
const ctm = this.app.container.getCTM().inverse();
const z = this.app.container.getCTM().inverse().a;
if (this.ix < ctm.e){
console.log("off left edge");
svgP = {x:ctm.e + ((this.getSymbolRadius() + 15 + this.labelSVG.getComputedTextLength())), y:this.iy};
}
if (this.ix > ctm.e + (width * z)){
console.log("off right edge");
svgP = {x:ctm.e + (width * z) - ((this.getSymbolRadius() + 5)), y:this.iy};
}
}

const transitionTime = transition ? Polymer.transitionTime : 0;
this.postAnimExpanded = false; // bit of a hack, used for updating listeners before anim complete, todo - is there better way
this.busy = true;
Expand Down

0 comments on commit 4b603dc

Please sign in to comment.