Skip to content

Commit 7cc34e8

Browse files
Release 0.7.2
1 parent 903cf08 commit 7cc34e8

File tree

6 files changed

+44
-39
lines changed

6 files changed

+44
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ProgressBar.js
22

3-
**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))
3+
**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))
44

55
<br>
66
![Beautiful animation](docs/animation.gif)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "progressbar.js",
33
"main": "dist/progressbar.js",
4-
"version": "0.7.1-dev",
4+
"version": "0.7.2",
55
"homepage": "https://github.com/kimmobrunfeldt/progressbar.js",
66
"authors": [
77
"Kimmo Brunfeldt <[email protected]>"

dist/progressbar.js

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ProgressBar.js 0.7.1
1+
// ProgressBar.js 0.7.2
22
// https://kimmobrunfeldt.github.io/progressbar.js
33
// License: MIT
44

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

1386-
var Progress = require('./progress');
1386+
var Shape = require('./shape');
13871387
var utils = require('./utils');
13881388

13891389

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

1398-
Progress.apply(this, arguments);
1398+
Shape.apply(this, arguments);
13991399
};
14001400

1401-
Circle.prototype = new Progress();
1401+
Circle.prototype = new Shape();
14021402
Circle.prototype.constructor = Circle;
14031403

14041404
Circle.prototype._pathString = function _pathString(opts) {
1405-
var r = 50 - opts.strokeWidth / 2;
1405+
var widthOfWider = opts.strokeWidth;
1406+
if (opts.trailWidth && opts.trailWidth > opts.strokeWidth) {
1407+
widthOfWider = opts.trailWidth;
1408+
}
1409+
1410+
var r = 50 - widthOfWider / 2;
14061411

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

14171422
module.exports = Circle;
14181423

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

1422-
var Progress = require('./progress');
1427+
var Shape = require('./shape');
14231428
var utils = require('./utils');
14241429

14251430

14261431
var Line = function Line(container, options) {
14271432
this._pathTemplate = 'M 0,{center} L 100,{center}';
1428-
Progress.apply(this, arguments);
1433+
Shape.apply(this, arguments);
14291434
};
14301435

1431-
Line.prototype = new Progress();
1436+
Line.prototype = new Shape();
14321437
Line.prototype.constructor = Line;
14331438

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

14491454
module.exports = Line;
14501455

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

16361641

1637-
var Progress = function Progress(container, opts) {
1642+
var Shape = function Shape(container, opts) {
16381643
// Throw a better error if progress bars are not initialized with `new`
16391644
// keyword
1640-
if (!(this instanceof Progress)) {
1645+
if (!(this instanceof Shape)) {
16411646
throw new Error('Constructor was called without new keyword');
16421647
}
16431648

16441649
// Prevent calling constructor without parameters so inheritance
1645-
// works correctly. To understand, this is how Progress is inherited:
1650+
// works correctly. To understand, this is how Shape is inherited:
16461651
//
1647-
// Line.prototype = new Progress();
1652+
// Line.prototype = new Shape();
16481653
//
16491654
// We just want to set the prototype for Line.
16501655
if (arguments.length === 0) return;
@@ -1698,17 +1703,17 @@ var Progress = function Progress(container, opts) {
16981703
this._progressPath = new Path(svgView.path, newOpts);
16991704
};
17001705

1701-
Progress.prototype.animate = function animate(progress, opts, cb) {
1706+
Shape.prototype.animate = function animate(progress, opts, cb) {
17021707
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17031708
this._progressPath.animate(progress, opts, cb);
17041709
};
17051710

1706-
Progress.prototype.stop = function stop() {
1711+
Shape.prototype.stop = function stop() {
17071712
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17081713
this._progressPath.stop();
17091714
};
17101715

1711-
Progress.prototype.destroy = function destroy() {
1716+
Shape.prototype.destroy = function destroy() {
17121717
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17131718

17141719
this.stop();
@@ -1724,17 +1729,17 @@ Progress.prototype.destroy = function destroy() {
17241729
}
17251730
};
17261731

1727-
Progress.prototype.set = function set(progress) {
1732+
Shape.prototype.set = function set(progress) {
17281733
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17291734
this._progressPath.set(progress);
17301735
};
17311736

1732-
Progress.prototype.value = function value() {
1737+
Shape.prototype.value = function value() {
17331738
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17341739
return this._progressPath.value();
17351740
};
17361741

1737-
Progress.prototype.setText = function setText(text) {
1742+
Shape.prototype.setText = function setText(text) {
17381743
if (this._progressPath === null) throw new Error(DESTROYED_ERROR);
17391744

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

1752-
Progress.prototype._createSvgView = function _createSvgView(opts) {
1757+
Shape.prototype._createSvgView = function _createSvgView(opts) {
17531758
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
17541759
this._initializeSvg(svg, opts);
17551760

@@ -1771,16 +1776,16 @@ Progress.prototype._createSvgView = function _createSvgView(opts) {
17711776
};
17721777
};
17731778

1774-
Progress.prototype._initializeSvg = function _initializeSvg(svg, opts) {
1779+
Shape.prototype._initializeSvg = function _initializeSvg(svg, opts) {
17751780
svg.setAttribute('viewBox', '0 0 100 100');
17761781
};
17771782

1778-
Progress.prototype._createPath = function _createPath(opts) {
1783+
Shape.prototype._createPath = function _createPath(opts) {
17791784
var pathString = this._pathString(opts);
17801785
return this._createPathElement(pathString, opts);
17811786
};
17821787

1783-
Progress.prototype._createTrail = function _createTrail(opts) {
1788+
Shape.prototype._createTrail = function _createTrail(opts) {
17841789
// Create path string with original passed options
17851790
var pathString = this._trailString(opts);
17861791

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

1804-
Progress.prototype._createPathElement = function _createPathElement(pathString, opts) {
1809+
Shape.prototype._createPathElement = function _createPathElement(pathString, opts) {
18051810
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
18061811
path.setAttribute('d', pathString);
18071812
path.setAttribute('stroke', opts.color);
@@ -1816,7 +1821,7 @@ Progress.prototype._createPathElement = function _createPathElement(pathString,
18161821
return path;
18171822
};
18181823

1819-
Progress.prototype._createTextElement = function _createTextElement(opts, container) {
1824+
Shape.prototype._createTextElement = function _createTextElement(opts, container) {
18201825
var element = document.createElement('p');
18211826
element.appendChild(document.createTextNode(opts.text.value));
18221827

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

1844-
Progress.prototype._pathString = function _pathString(opts) {
1849+
Shape.prototype._pathString = function _pathString(opts) {
18451850
throw new Error('Override this function for each progress bar');
18461851
};
18471852

1848-
Progress.prototype._trailString = function _trailString(opts) {
1853+
Shape.prototype._trailString = function _trailString(opts) {
18491854
throw new Error('Override this function for each progress bar');
18501855
};
18511856

1852-
module.exports = Progress;
1857+
module.exports = Shape;
18531858

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

1857-
var Progress = require('./progress');
1862+
var Shape = require('./shape');
18581863
var utils = require('./utils');
18591864

18601865

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

1876-
Progress.apply(this, arguments);
1881+
Shape.apply(this, arguments);
18771882
};
18781883

1879-
Square.prototype = new Progress();
1884+
Square.prototype = new Shape();
18801885
Square.prototype.constructor = Square;
18811886

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

19031908
module.exports = Square;
19041909

1905-
},{"./progress":6,"./utils":8}],8:[function(require,module,exports){
1910+
},{"./shape":6,"./utils":8}],8:[function(require,module,exports){
19061911
// Utility functions
19071912

19081913
var PREFIXES = 'webkit moz o ms'.split(' ');

0 commit comments

Comments
 (0)