Skip to content

Commit

Permalink
Fix d3#127: circular fisheye scaling factor.
Browse files Browse the repository at this point in the history
This fixes the scaling value `z` when the focus point is exactly on an
object’s position.

Also fixes d3#126.
  • Loading branch information
jasondavies committed Mar 16, 2015
1 parent 36735c9 commit 1679975
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fisheye/fisheye.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var dx = d.x - focus[0],
dy = d.y - focus[1],
dd = Math.sqrt(dx * dx + dy * dy);
if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1};
if (!dd || dd >= radius) return {x: d.x, y: d.y, z: dd >= radius ? 1 : 10};
var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25;
return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)};
}
Expand Down

0 comments on commit 1679975

Please sign in to comment.