From b6ead1dbf23cc85e634c819e4d32005c2de8aede Mon Sep 17 00:00:00 2001 From: mourner Date: Wed, 15 Sep 2010 16:45:16 +0300 Subject: [PATCH] Transformation fix --- spec/suites/geometry/TransformationSpec.js | 8 ++++---- src/geometry/Transformation.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/suites/geometry/TransformationSpec.js b/spec/suites/geometry/TransformationSpec.js index 080fe9ab..8a945df1 100644 --- a/spec/suites/geometry/TransformationSpec.js +++ b/spec/suites/geometry/TransformationSpec.js @@ -7,13 +7,13 @@ describe("Transformation", function() { }); it("#transform should perform a transformation", function() { - var p2 = t.transform(p); - expect(p2).toEqual(new L.Point(12, 64)); + var p2 = t.transform(p, 2); + expect(p2).toEqual(new L.Point(24, 128)); }); it("#untransform should perform a reverse transformation", function() { - var p2 = t.transform(p); - var p3 = t.untransform(p2); + var p2 = t.transform(p, 2); + var p3 = t.untransform(p2, 2); expect(p3).toEqual(p); }); }); \ No newline at end of file diff --git a/src/geometry/Transformation.js b/src/geometry/Transformation.js index 08d54435..439d4481 100644 --- a/src/geometry/Transformation.js +++ b/src/geometry/Transformation.js @@ -20,7 +20,7 @@ L.Transformation = L.Class.extend({ untransform: function(/*Point*/ point, /*Number*/ scale) /*-> Point*/ { scale = scale || 1; return new L.Point( - ((point.x - this._b) / this._a) / scale, - ((point.y - this._d) / this._c) / scale); + (point.x/scale - this._b) / this._a, + (point.y/scale - this._d) / this._c); } }); \ No newline at end of file