Skip to content

Commit

Permalink
zoom bug: function and var with same name
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacioola committed Jul 7, 2011
1 parent 489eb0c commit 9b52078
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions d3.behavior.js
Expand Up @@ -8,7 +8,7 @@ d3.behavior.zoom = function() {
z = 0,
listeners = [],
pan,
zoom;
_zoom;

function zoom() {
var container = this
Expand All @@ -35,7 +35,7 @@ d3.behavior.zoom = function() {
}

function mousemove() {
zoom = null;
_zoom = null;
if (pan) {
x = d3.event.clientX + pan.x0;
y = d3.event.clientY + pan.y0;
Expand Down Expand Up @@ -68,9 +68,9 @@ d3.behavior.zoom = function() {
var e = d3.event;

// initialize the mouse location for zooming (to avoid drift)
if (!zoom) {
if (!_zoom) {
var p = d3.svg.mouse(this.nearestViewportElement || this);
zoom = {
_zoom = {
x0: x,
y0: y,
z0: z,
Expand Down Expand Up @@ -98,9 +98,9 @@ d3.behavior.zoom = function() {
}

// adjust x and y to center around mouse location
var k = Math.pow(2, z - zoom.z0) - 1;
x = zoom.x0 + zoom.x1 * k;
y = zoom.y0 + zoom.y1 * k;
var k = Math.pow(2, z - _zoom.z0) - 1;
x = _zoom.x0 + _zoom.x1 * k;
y = _zoom.y0 + _zoom.y1 * k;

// dispatch redraw
dispatch.call(this, d, i);
Expand Down

0 comments on commit 9b52078

Please sign in to comment.