Skip to content

Commit 4b603dc

Browse files
committed
fix for collapsing proteins from table (keep them on screen)
1 parent 78432c5 commit 4b603dc

5 files changed

Lines changed: 23 additions & 4 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/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export class App {
239239

240240
collapseProtein() {
241241
d3.select(".custom-menu-margin").style("display", "none");
242-
this.contextMenuProt.setExpanded(false, this.contextMenuPoint);
242+
this.contextMenuProt.setExpanded(false);//, this.contextMenuPoint);
243243
this.contextMenuProt = null;
244244
this.notifyExpandListeners();
245245
}

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)