Skip to content

Commit d01651e

Browse files
authored
Merge pull request #188 from colin-combe/master
fix for collapsing proteins from table (keep them on screen)
2 parents 35a38ab + 2f1ad6f commit d01651e

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

dist/complexviewer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "complexviewer",
3-
"version": "2.1.15",
3+
"version": "2.1.16",
44
"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.",
55
"author": {
66
"name": "Colin Combe",

src/js/viz/interactor/interactor.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ export class Interactor {
148148
//remember previous position
149149
this.px = this.x;
150150
this.py = this.y;
151-
152151
let xOffset = (this.width / 2 - (this.getSymbolRadius()));
152+
/*
153+
// let xOffset = (15 + this.labelSVG.getComputedTextLength()) / 2;
154+
// would also work because
155+
// width = (2 * this.getSymbolRadius()) + 15 + this.labelSVG.getComputedTextLength();
156+
*/
153157
if (this.expanded) {
154158
xOffset = xOffset - (this.size / 2 * this.stickZoom);
155159
}

src/js/viz/interactor/polymer.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ export class Polymer extends Interactor {
159159
}
160160

161161
toCircle(transition = true, svgP) {
162+
163+
if (!svgP) {
164+
const width = this.app.svgElement.parentNode.clientWidth;
165+
const ctm = this.app.container.getCTM().inverse();
166+
const z = this.app.container.getCTM().inverse().a;
167+
if (this.ix < ctm.e){
168+
console.log("off left edge");
169+
svgP = {x:ctm.e + ((this.getSymbolRadius() + 15 + this.labelSVG.getComputedTextLength())), y:this.iy};
170+
}
171+
if (this.ix > ctm.e + (width * z)){
172+
console.log("off right edge");
173+
svgP = {x:ctm.e + (width * z) - ((this.getSymbolRadius() + 5)), y:this.iy};
174+
}
175+
}
176+
162177
const transitionTime = transition ? Polymer.transitionTime : 0;
163178
this.postAnimExpanded = false; // bit of a hack, used for updating listeners before anim complete, todo - is there better way
164179
this.busy = true;

0 commit comments

Comments
 (0)