Skip to content

Commit

Permalink
Change width/height calc. Trim prmtop atom names.
Browse files Browse the repository at this point in the history
Previous calculation did not account for applied scaling
transformations.  Now remove whitespace from prmtop atom names.
  • Loading branch information
dkoes committed Mar 13, 2024
1 parent 0a69191 commit cf59124
Show file tree
Hide file tree
Showing 4 changed files with 27,589 additions and 27,580 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 21 additions & 12 deletions src/GLViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,39 @@ export class GLViewer {
private spinInterval: any;


//reimplement jquery getwidth/height
private getRect() {
private getWidth() {
let div = this.container;
let rect = div.getBoundingClientRect();
if (rect.width == 0 && rect.height == 0 && div.style.display === 'none') {
//offsetwidth accounts for scaling
let w = div.offsetWidth;
if(w == 0 && div.style.display === 'none') {
let oldpos = div.style.position;
let oldvis = div.style.visibility;
div.style.display = 'block';
div.style.visibility = 'hidden';
div.style.position = 'absolute';
rect = div.getBoundingClientRect();
w = div.offsetWidth;
div.style.display = 'none';
div.style.visibility = oldvis;
div.style.position = oldpos;
div.style.position = oldpos;
}
return rect;
};

private getWidth() {
return this.getRect().width;
return w;
};

private getHeight() {
return this.getRect().height;
let div = this.container;
let h = div.offsetHeight;
if(h == 0 && div.style.display === 'none') {
let oldpos = div.style.position;
let oldvis = div.style.visibility;
div.style.display = 'block';
div.style.visibility = 'hidden';
div.style.position = 'absolute';
h = div.offsetHeight;
div.style.display = 'none';
div.style.visibility = oldvis;
div.style.position = oldpos;
}
return h;
};

private setupRenderer() {
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/PRMTOP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export function PRMTOP(str: string /*, options*/) {
atom.x = 0;
atom.y = 0;
atom.z = 0;
atom.atom = lines[index + 1].slice(col[1] * j, col[1] * (j + 1));
atom.elem = lines[index + 1].slice(col[1] * j, col[1] * j + 1);
atom.atom = lines[index + 1].slice(col[1] * j, col[1] * (j + 1)).trim();
atom.elem = lines[index + 1].slice(col[1] * j, col[1] * j + 1).trim();
atom.properties = properties;
atom.bonds = [];
atom.bondOrder = [];
Expand Down
Loading

0 comments on commit cf59124

Please sign in to comment.