add more ansii image methods for animation. fix test.

This commit is contained in:
Christopher Jeffrey 2015-07-17 03:06:33 -07:00
parent 2a8f232d18
commit 89debe2577
3 changed files with 17 additions and 1 deletions

View File

@ -1493,6 +1493,9 @@ installed.
- __setImage(file)__ - Set the image in the box to a new path. File can be a
path, url, or buffer.
- __clearImage()__ - Clear the image.
- __play()__ - Play animation if it has been paused or stopped.
- __pause()__ - Pause animation.
- __stop()__ - Stop animation.
#### OverlayImage (from Box)

View File

@ -118,7 +118,20 @@ ANSIImage.prototype.setImage = function(file) {
}
};
ANSIImage.prototype.play = function() {
return this.img.play();
};
ANSIImage.prototype.pause = function() {
return this.img.pause();
};
ANSIImage.prototype.stop = function() {
return this.img.stop();
};
ANSIImage.prototype.clearImage = function() {
if (this.img && this.img.frames) {
this.stop();
}
this.setContent('');
this.img = null;
this.cellmap = null;

View File

@ -61,7 +61,7 @@ var url = 'https://people.mozilla.org/~dolske/apng/spinfox.png';
if (!file) {
try {
if (!fs.existsSync(spinfox)) {
var buf = blessed.png.curl(url);
var buf = blessed.ansiimage.curl(url);
fs.writeFileSync(spinfox, buf);
}
file = spinfox;