Skip to content

Commit

Permalink
Merge pull request #188 from colin-combe/master
Browse files Browse the repository at this point in the history
fix for collapsing proteins from table (keep them on screen)
  • Loading branch information
colin-combe authored Oct 19, 2021
2 parents 35a38ab + 2f1ad6f commit d01651e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 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
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 d01651e

Please sign in to comment.