Skip to content

Commit

Permalink
Release 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kimmobrunfeldt committed Jan 12, 2015
1 parent 903cf08 commit 7cc34e8
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ProgressBar.js

**Version: 0.7.1** ([*previous stable*](https://github.com/kimmobrunfeldt/progressbar.js/tree/0.7.0), [*latest dev*](https://github.com/kimmobrunfeldt/progressbar.js/tree/dev))
**Version: 0.7.1** ([*previous stable*](https://github.com/kimmobrunfeldt/progressbar.js/tree/0.7.1), [*latest dev*](https://github.com/kimmobrunfeldt/progressbar.js/tree/dev))

<br>
![Beautiful animation](docs/animation.gif)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "progressbar.js",
"main": "dist/progressbar.js",
"version": "0.7.1-dev",
"version": "0.7.2",
"homepage": "https://github.com/kimmobrunfeldt/progressbar.js",
"authors": [
"Kimmo Brunfeldt <kimmobrunfeldt@gmail.com>"
Expand Down
71 changes: 38 additions & 33 deletions dist/progressbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ProgressBar.js 0.7.1
// ProgressBar.js 0.7.2
// https://kimmobrunfeldt.github.io/progressbar.js
// License: MIT

Expand Down Expand Up @@ -1383,7 +1383,7 @@ function token () {
},{}],2:[function(require,module,exports){
// Circle shaped progress bar

var Progress = require('./progress');
var Shape = require('./shape');
var utils = require('./utils');


Expand All @@ -1395,14 +1395,19 @@ var Circle = function Circle(container, options) {
' a {radius},{radius} 0 1 1 0,{2radius}' +
' a {radius},{radius} 0 1 1 0,-{2radius}';

Progress.apply(this, arguments);
Shape.apply(this, arguments);
};

Circle.prototype = new Progress();
Circle.prototype = new Shape();
Circle.prototype.constructor = Circle;

Circle.prototype._pathString = function _pathString(opts) {
var r = 50 - opts.strokeWidth / 2;
var widthOfWider = opts.strokeWidth;
if (opts.trailWidth && opts.trailWidth > opts.strokeWidth) {
widthOfWider = opts.trailWidth;
}

var r = 50 - widthOfWider / 2;

return utils.render(this._pathTemplate, {
radius: r,
Expand All @@ -1416,19 +1421,19 @@ Circle.prototype._trailString = function _trailString(opts) {

module.exports = Circle;

},{"./progress":6,"./utils":8}],3:[function(require,module,exports){
},{"./shape":6,"./utils":8}],3:[function(require,module,exports){
// Line shaped progress bar

var Progress = require('./progress');
var Shape = require('./shape');
var utils = require('./utils');


var Line = function Line(container, options) {
this._pathTemplate = 'M 0,{center} L 100,{center}';
Progress.apply(this, arguments);
Shape.apply(this, arguments);
};

Line.prototype = new Progress();
Line.prototype = new Shape();
Line.prototype.constructor = Line;

Line.prototype._initializeSvg = function _initializeSvg(svg, opts) {
Expand All @@ -1448,7 +1453,7 @@ Line.prototype._trailString = function _trailString(opts) {

module.exports = Line;

},{"./progress":6,"./utils":8}],4:[function(require,module,exports){
},{"./shape":6,"./utils":8}],4:[function(require,module,exports){
// Different shaped progress bars
var Line = require('./line');
var Circle = require('./circle');
Expand Down Expand Up @@ -1634,17 +1639,17 @@ var utils = require('./utils');
var DESTROYED_ERROR = 'Object is destroyed';


var Progress = function Progress(container, opts) {
var Shape = function Shape(container, opts) {
// Throw a better error if progress bars are not initialized with `new`
// keyword
if (!(this instanceof Progress)) {
if (!(this instanceof Shape)) {
throw new Error('Constructor was called without new keyword');
}

// Prevent calling constructor without parameters so inheritance
// works correctly. To understand, this is how Progress is inherited:
// works correctly. To understand, this is how Shape is inherited:
//
// Line.prototype = new Progress();
// Line.prototype = new Shape();
//
// We just want to set the prototype for Line.
if (arguments.length === 0) return;
Expand Down Expand Up @@ -1698,17 +1703,17 @@ var Progress = function Progress(container, opts) {
this._progressPath = new Path(svgView.path, newOpts);
};

Progress.prototype.animate = function animate(progress, opts, cb) {
Shape.prototype.animate = function animate(progress, opts, cb) {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
this._progressPath.animate(progress, opts, cb);
};

Progress.prototype.stop = function stop() {
Shape.prototype.stop = function stop() {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
this._progressPath.stop();
};

Progress.prototype.destroy = function destroy() {
Shape.prototype.destroy = function destroy() {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);

this.stop();
Expand All @@ -1724,17 +1729,17 @@ Progress.prototype.destroy = function destroy() {
}
};

Progress.prototype.set = function set(progress) {
Shape.prototype.set = function set(progress) {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
this._progressPath.set(progress);
};

Progress.prototype.value = function value() {
Shape.prototype.value = function value() {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
return this._progressPath.value();
};

Progress.prototype.setText = function setText(text) {
Shape.prototype.setText = function setText(text) {
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);

if (this.text === null) {
Expand All @@ -1749,7 +1754,7 @@ Progress.prototype.setText = function setText(text) {
this.text.appendChild(document.createTextNode(text));
};

Progress.prototype._createSvgView = function _createSvgView(opts) {
Shape.prototype._createSvgView = function _createSvgView(opts) {
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this._initializeSvg(svg, opts);

Expand All @@ -1771,16 +1776,16 @@ Progress.prototype._createSvgView = function _createSvgView(opts) {
};
};

Progress.prototype._initializeSvg = function _initializeSvg(svg, opts) {
Shape.prototype._initializeSvg = function _initializeSvg(svg, opts) {
svg.setAttribute('viewBox', '0 0 100 100');
};

Progress.prototype._createPath = function _createPath(opts) {
Shape.prototype._createPath = function _createPath(opts) {
var pathString = this._pathString(opts);
return this._createPathElement(pathString, opts);
};

Progress.prototype._createTrail = function _createTrail(opts) {
Shape.prototype._createTrail = function _createTrail(opts) {
// Create path string with original passed options
var pathString = this._trailString(opts);

Expand All @@ -1801,7 +1806,7 @@ Progress.prototype._createTrail = function _createTrail(opts) {
return this._createPathElement(pathString, newOpts);
};

Progress.prototype._createPathElement = function _createPathElement(pathString, opts) {
Shape.prototype._createPathElement = function _createPathElement(pathString, opts) {
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
path.setAttribute('d', pathString);
path.setAttribute('stroke', opts.color);
Expand All @@ -1816,7 +1821,7 @@ Progress.prototype._createPathElement = function _createPathElement(pathString,
return path;
};

Progress.prototype._createTextElement = function _createTextElement(opts, container) {
Shape.prototype._createTextElement = function _createTextElement(opts, container) {
var element = document.createElement('p');
element.appendChild(document.createTextNode(opts.text.value));

Expand All @@ -1841,20 +1846,20 @@ Progress.prototype._createTextElement = function _createTextElement(opts, contai
return element;
};

Progress.prototype._pathString = function _pathString(opts) {
Shape.prototype._pathString = function _pathString(opts) {
throw new Error('Override this function for each progress bar');
};

Progress.prototype._trailString = function _trailString(opts) {
Shape.prototype._trailString = function _trailString(opts) {
throw new Error('Override this function for each progress bar');
};

module.exports = Progress;
module.exports = Shape;

},{"./path":5,"./utils":8}],7:[function(require,module,exports){
// Square shaped progress bar

var Progress = require('./progress');
var Shape = require('./shape');
var utils = require('./utils');


Expand All @@ -1873,10 +1878,10 @@ var Square = function Square(container, options) {
' L {halfOfStrokeWidth},{width}' +
' L {halfOfStrokeWidth},{halfOfStrokeWidth}';

Progress.apply(this, arguments);
Shape.apply(this, arguments);
};

Square.prototype = new Progress();
Square.prototype = new Shape();
Square.prototype.constructor = Square;

Square.prototype._pathString = function _pathString(opts) {
Expand All @@ -1902,7 +1907,7 @@ Square.prototype._trailString = function _trailString(opts) {

module.exports = Square;

},{"./progress":6,"./utils":8}],8:[function(require,module,exports){
},{"./shape":6,"./utils":8}],8:[function(require,module,exports){
// Utility functions

var PREFIXES = 'webkit moz o ms'.split(' ');
Expand Down
Loading

0 comments on commit 7cc34e8

Please sign in to comment.