Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkueng committed Aug 31, 2015
1 parent 95c1924 commit 8383f43
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -5,7 +5,7 @@
"type": "git",
"url": "git://github.com/maxkueng/victor.git"
},
"version": "1.0.0",
"version": "1.1.0",
"homepage": "https://github.com/maxkueng/victor",
"authors": [
"Max Kueng (http://maxkueng.com/)",
Expand Down
21 changes: 21 additions & 0 deletions build/victor.js
Expand Up @@ -814,6 +814,27 @@ Victor.prototype.unfloat = function () {
return this;
};

/**
* Rounds both axis to a certain precision
*
* ### Examples:
* var vec = new Victor(100.2, 50.9);
*
* vec.unfloat();
* vec.toString();
* // => x:100, y:51
*
* @param {Number} Precision (default: 8)
* @return {Victor} `this` for chaining capabilities
* @api public
*/
Victor.prototype.toFixed = function (precision) {
if (typeof precision === 'undefined') { precision = 8; }
this.x = this.x.toFixed(precision);
this.y = this.y.toFixed(precision);
return this;
};

/**
* Performs a linear blend / interpolation of the X axis towards another vector
*
Expand Down
2 changes: 1 addition & 1 deletion build/victor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions documentation/api.md
Expand Up @@ -719,6 +719,25 @@ Rounds both axis to an integer value

* **Victor** `this` for chaining capabilities

## toFixed(Precision)

Rounds both axis to a certain precision

### Examples:
var vec = new Victor(100.2, 50.9);

vec.unfloat();
vec.toString();
// => x:100, y:51

### Params:

* **Number** *Precision* (default: 8)

### Return:

* **Victor** `this` for chaining capabilities

## mixX(vector, amount)

Performs a linear blend / interpolation of the X axis towards another vector
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "victor",
"version": "1.0.0",
"version": "1.1.0",
"description": "A JavaScript 2D vector class with methods for common vector operations",
"keywords": [
"vector",
Expand Down

0 comments on commit 8383f43

Please sign in to comment.