Skip to content

Commit

Permalink
Fix wide MPAtom label update issue [bugfix]
Browse files Browse the repository at this point in the history
  • Loading branch information
bergwerf committed Feb 4, 2015
1 parent f3df23c commit 8c4a345
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 23 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Changelog

## 2.3.3 (2015-2-3)
## 2.3.3 (2015-2-4)

- Revised MolPad invalidation logic
= Redesigned HTML input and welcome dialog
- Redesigned HTML input and welcome dialog
- Migrated to strict comparisons only in JS source
- Migrated to SourceForge as primary Jmol build origin
= Implemented Sketcher update style based on MolPad fingerprints
- Implemented Sketcher updated state based on MolPad fingerprints
- Implemented updated PubChem description API (duplicate records)
- Implemented updated PubChem search API (which uses Entrez sorting)
= Added coordinates flag check to COD CIF mirror
= Added JSmol HQ disabling for touch-only devices
- Added coordinates flag check to COD CIF mirror
- Added JSmol HQ disabling for touch-only devices
- Added magenta coloring and large font for Jmol charge labels
- Added saveSize to window.onresize (sizeChanged bug)
- Added notfound message to Loader Messages
Expand All @@ -23,7 +23,7 @@
- Added lonely neighbors to atom deletion
- Added real skeletal bond style
- Added incorrect state for atoms
= Fixed persistent active state after multi-touch start
- Fixed persistent active state after multi-touch start
- Fixed drag delta calculation error
- Fixed 3+ touches to 2 touches transition
- Fixed onPoinerUp canvas dragging fallback for single touches with a defined handler
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Instructions:
3. Configure ErrorDocument in `.htaccess` to point to `page.php`
4. Make sure the Inkscape and the ImageMagick CLI are installed
5. Install npm and install local npm modules
6. Run `./build.sh fetch JmolNightly`
6. Run `./build.sh fetch jmol`

Committing
---------
Expand Down
6 changes: 3 additions & 3 deletions src/js/molpad/MPAtom.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,15 @@ MPAtom.prototype.drawStateColor = function()
this.mp.ctx.beginPath();
if(this.line.area.point)
{
this.mp.ctx.arc(this.line.area.point.x, this.line.area.point.y,
this.mp.ctx.arc(this.center.x, this.center.y,
this.mp.s.atom.selectionRadiusScaled, 0, PI2);
this.mp.ctx.fillStyle = this.mp.s.atom[d].color;
this.mp.ctx.fill();
}
else
{
this.mp.ctx.moveTo(this.line.area.left.x, this.line.area.left.y);
this.mp.ctx.lineTo(this.line.area.right.x, this.line.area.right.y);
this.mp.ctx.moveTo(this.center.x + this.line.area.left, this.center.y);
this.mp.ctx.lineTo(this.center.x + this.line.area.right, this.center.y);
this.mp.ctx.strokeStyle = this.mp.s.atom[d].color;
this.mp.ctx.stroke();
}
Expand Down
12 changes: 6 additions & 6 deletions src/js/molpad/MPAtom_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ MPAtom.prototype.calculateCenterLine = function()
{
return {
text: { offsetLeft: 0, offsetTop: 0 },
area: { point: this.center }
area: { point: true }
};
}

Expand Down Expand Up @@ -184,16 +184,16 @@ MPAtom.prototype.calculateCenterLine = function()
text: text,
area: {
half: halfw + pad,
left: { x: this.center.x - halfw + pad, y: this.center.y },
right: { x: this.center.x + halfw - pad, y: this.center.y }
left: -halfw + pad,
right: halfw - pad
}
};
}
else
{
return {
text: text,
area: { point: this.center }
area: { point: true }
};
}
}
Expand Down Expand Up @@ -294,11 +294,11 @@ MPAtom.prototype._calculateBondVertices = function(begin, ends)

if(this.line.area.left && begin.x < this.center.x)
{
ac = this.line.area.left;
ac = new MPPoint(this.center.x + this.line.area.left, this.center.y);
}
else if(this.line.area.right && begin.x > this.center.x)
{
ac = this.line.area.right;
ac = new MPPoint(this.center.x + this.line.area.right, this.center.y);
tdir = -1;
}

Expand Down
10 changes: 6 additions & 4 deletions src/js/molpad/MPAtom_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,9 @@ MPAtom.prototype.handle = function(point, type)

if(this.line.area.point)
{
if(point.inCircleBox(this.line.area.point, r))
if(point.inCircleBox(this.center, r))
{
if(point.inCircle(this.line.area.point, r))
if(point.inCircle(this.center, r))
{
this.setDisplay(type);
return true;
Expand All @@ -573,9 +573,11 @@ MPAtom.prototype.handle = function(point, type)
}
else
{
if(point.inLineBox(this.line.area.left, this.line.area.right, r))
var lp = new MPPoint(this.center.x + this.line.area.left, this.center.y);
var rp = new MPPoint(this.center.x + this.line.area.right, this.center.y);
if(point.inLineBox(lp, rp, r))
{
if(point.lineDistance(this.line.area.left, this.line.area.right) <= r)
if(point.lineDistance(lp, rp) <= r)
{
this.setDisplay(type);
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/js/molpad/MPMolecule.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@ MPMolecule.prototype.getBBox = function()
{
//calculate center line since molecule might not be updated yet
var l = this.atoms[i].calculateCenterLine();
var px1 = l.area.left !== undefined ? l.area.left.x : l.area.point.x;
var px2 = l.area.right !== undefined ? l.area.right.x : l.area.point.x;
var py = l.area.left !== undefined ? l.area.left.y : l.area.point.y;
var px1 = this.atoms[i].center.x + (l.area.point ? 0 : l.area.left);
var px2 = this.atoms[i].center.x + (l.area.point ? 0 : l.area.right);
var py = this.atoms[i].center.y;

if(bottomLeft === undefined)
{
Expand Down
1 change: 1 addition & 0 deletions src/less/welcome.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
max-width: 800px;
text-align: center;
background: @light2;
background: -webkit-radial-gradient(#fff,#fff,#aaa);
}

@media all and (min-width: 700px)
Expand Down

0 comments on commit 8c4a345

Please sign in to comment.