Skip to content
This repository has been archived by the owner on Jun 15, 2018. It is now read-only.

Commit

Permalink
Add scaling for lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
bemjb committed Aug 27, 2012
1 parent 82f4d85 commit 87809fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.js
Expand Up @@ -166,12 +166,17 @@ define(function (require, exports, module) {
function ShapeScaler(minMax, size) {
this._translate = minMax.min;
this._scale = size / (minMax.max - this._translate);
this._lengthScale = size / (minMax.max - minMax.min);
}

ShapeScaler.prototype.scale = function (x) {
return (x - this._translate) * this._scale;
};

ShapeScaler.prototype.scaleLength = function (x) {
return x + this._lengthScale;
}

return ShapeScaler;
}());

Expand Down

0 comments on commit 87809fc

Please sign in to comment.