term-canvas
Advanced tools
Comparing version 0.0.4 to 0.0.5
0.0.5 / 2012-07-21 | ||
================== | ||
* add tabs example | ||
* fix nested translations | ||
0.0.4 / 2011-12-05 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -63,2 +63,16 @@ | ||
/** | ||
* Get additive state `prop`. | ||
* | ||
* @param {String} prop | ||
* @return {Number} | ||
* @api private | ||
*/ | ||
Context2d.prototype.getState = function(prop){ | ||
return this.states.reduce(function(sum, state){ | ||
return sum + state[prop]; | ||
}, 0); | ||
}; | ||
/** | ||
* Push a new `State` object to the stack. | ||
@@ -360,5 +374,4 @@ * | ||
Context2d.prototype.fillText = function(str, x, y){ | ||
var state = this.state(); | ||
x += state.translateX; | ||
y += state.translateY; | ||
x += this.getState('translateX'); | ||
y += this.getState('translateY'); | ||
this.applyForegroundFillStyle(); | ||
@@ -408,8 +421,12 @@ this.moveTo(x, y); | ||
Context2d.prototype.strokeRect = function(x, y, w, h){ | ||
var state = this.state(); | ||
w *= state.scaleX; | ||
h *= state.scaleY; | ||
x += state.translateX; | ||
y += state.translateY; | ||
var sx = this.state().scaleX; | ||
var sy = this.state().scaleY; | ||
var tx = this.getState('translateX'); | ||
var ty = this.getState('translateY'); | ||
w *= sx; | ||
h *= sy; | ||
x += tx; | ||
y += ty; | ||
var hr = Array(Math.round(w + 1)).join(' '); | ||
@@ -440,8 +457,12 @@ this.applyStrokeStyle(); | ||
Context2d.prototype.fillRect = function(ox, oy, w, h){ | ||
var state = this.state(); | ||
w *= state.scaleX; | ||
h *= state.scaleY; | ||
ox += state.translateX; | ||
oy += state.translateY; | ||
var sx = this.state().scaleX; | ||
var sy = this.state().scaleY; | ||
var tx = this.getState('translateX'); | ||
var ty = this.getState('translateY'); | ||
w *= sx; | ||
h *= sy; | ||
ox += tx; | ||
oy += ty; | ||
this.applyFillStyle(); | ||
@@ -448,0 +469,0 @@ for (var y = 0; y < h; ++y) { |
@@ -18,8 +18,2 @@ | ||
exports = module.exports = Canvas; | ||
/** | ||
* Library version. | ||
*/ | ||
exports.version = '0.0.4'; | ||
module.exports = Canvas; |
{ | ||
"name": "term-canvas" | ||
, "version": "0.0.4" | ||
, "version": "0.0.5" | ||
, "description": "Terminal canvas api written with node.js" | ||
@@ -9,3 +9,2 @@ , "keywords": ["canvas", "ascii", "ansi", "terminal", "shell"] | ||
, "main": "index" | ||
, "engines": { "node": "0.6.x" } | ||
} |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
13839
10
485
1