1
- // ProgressBar.js 0.7.1
1
+ // ProgressBar.js 0.7.2
2
2
// https://kimmobrunfeldt.github.io/progressbar.js
3
3
// License: MIT
4
4
@@ -1383,7 +1383,7 @@ function token () {
1383
1383
} , { } ] , 2 :[ function ( require , module , exports ) {
1384
1384
// Circle shaped progress bar
1385
1385
1386
- var Progress = require ( './progress ' ) ;
1386
+ var Shape = require ( './shape ' ) ;
1387
1387
var utils = require ( './utils' ) ;
1388
1388
1389
1389
@@ -1395,14 +1395,19 @@ var Circle = function Circle(container, options) {
1395
1395
' a {radius},{radius} 0 1 1 0,{2radius}' +
1396
1396
' a {radius},{radius} 0 1 1 0,-{2radius}' ;
1397
1397
1398
- Progress . apply ( this , arguments ) ;
1398
+ Shape . apply ( this , arguments ) ;
1399
1399
} ;
1400
1400
1401
- Circle . prototype = new Progress ( ) ;
1401
+ Circle . prototype = new Shape ( ) ;
1402
1402
Circle . prototype . constructor = Circle ;
1403
1403
1404
1404
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 ;
1406
1411
1407
1412
return utils . render ( this . _pathTemplate , {
1408
1413
radius : r ,
@@ -1416,19 +1421,19 @@ Circle.prototype._trailString = function _trailString(opts) {
1416
1421
1417
1422
module . exports = Circle ;
1418
1423
1419
- } , { "./progress " :6 , "./utils" :8 } ] , 3 :[ function ( require , module , exports ) {
1424
+ } , { "./shape " :6 , "./utils" :8 } ] , 3 :[ function ( require , module , exports ) {
1420
1425
// Line shaped progress bar
1421
1426
1422
- var Progress = require ( './progress ' ) ;
1427
+ var Shape = require ( './shape ' ) ;
1423
1428
var utils = require ( './utils' ) ;
1424
1429
1425
1430
1426
1431
var Line = function Line ( container , options ) {
1427
1432
this . _pathTemplate = 'M 0,{center} L 100,{center}' ;
1428
- Progress . apply ( this , arguments ) ;
1433
+ Shape . apply ( this , arguments ) ;
1429
1434
} ;
1430
1435
1431
- Line . prototype = new Progress ( ) ;
1436
+ Line . prototype = new Shape ( ) ;
1432
1437
Line . prototype . constructor = Line ;
1433
1438
1434
1439
Line . prototype . _initializeSvg = function _initializeSvg ( svg , opts ) {
@@ -1448,7 +1453,7 @@ Line.prototype._trailString = function _trailString(opts) {
1448
1453
1449
1454
module . exports = Line ;
1450
1455
1451
- } , { "./progress " :6 , "./utils" :8 } ] , 4 :[ function ( require , module , exports ) {
1456
+ } , { "./shape " :6 , "./utils" :8 } ] , 4 :[ function ( require , module , exports ) {
1452
1457
// Different shaped progress bars
1453
1458
var Line = require ( './line' ) ;
1454
1459
var Circle = require ( './circle' ) ;
@@ -1634,17 +1639,17 @@ var utils = require('./utils');
1634
1639
var DESTROYED_ERROR = 'Object is destroyed' ;
1635
1640
1636
1641
1637
- var Progress = function Progress ( container , opts ) {
1642
+ var Shape = function Shape ( container , opts ) {
1638
1643
// Throw a better error if progress bars are not initialized with `new`
1639
1644
// keyword
1640
- if ( ! ( this instanceof Progress ) ) {
1645
+ if ( ! ( this instanceof Shape ) ) {
1641
1646
throw new Error ( 'Constructor was called without new keyword' ) ;
1642
1647
}
1643
1648
1644
1649
// 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:
1646
1651
//
1647
- // Line.prototype = new Progress ();
1652
+ // Line.prototype = new Shape ();
1648
1653
//
1649
1654
// We just want to set the prototype for Line.
1650
1655
if ( arguments . length === 0 ) return ;
@@ -1698,17 +1703,17 @@ var Progress = function Progress(container, opts) {
1698
1703
this . _progressPath = new Path ( svgView . path , newOpts ) ;
1699
1704
} ;
1700
1705
1701
- Progress . prototype . animate = function animate ( progress , opts , cb ) {
1706
+ Shape . prototype . animate = function animate ( progress , opts , cb ) {
1702
1707
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1703
1708
this . _progressPath . animate ( progress , opts , cb ) ;
1704
1709
} ;
1705
1710
1706
- Progress . prototype . stop = function stop ( ) {
1711
+ Shape . prototype . stop = function stop ( ) {
1707
1712
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1708
1713
this . _progressPath . stop ( ) ;
1709
1714
} ;
1710
1715
1711
- Progress . prototype . destroy = function destroy ( ) {
1716
+ Shape . prototype . destroy = function destroy ( ) {
1712
1717
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1713
1718
1714
1719
this . stop ( ) ;
@@ -1724,17 +1729,17 @@ Progress.prototype.destroy = function destroy() {
1724
1729
}
1725
1730
} ;
1726
1731
1727
- Progress . prototype . set = function set ( progress ) {
1732
+ Shape . prototype . set = function set ( progress ) {
1728
1733
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1729
1734
this . _progressPath . set ( progress ) ;
1730
1735
} ;
1731
1736
1732
- Progress . prototype . value = function value ( ) {
1737
+ Shape . prototype . value = function value ( ) {
1733
1738
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1734
1739
return this . _progressPath . value ( ) ;
1735
1740
} ;
1736
1741
1737
- Progress . prototype . setText = function setText ( text ) {
1742
+ Shape . prototype . setText = function setText ( text ) {
1738
1743
if ( this . _progressPath === null ) throw new Error ( DESTROYED_ERROR ) ;
1739
1744
1740
1745
if ( this . text === null ) {
@@ -1749,7 +1754,7 @@ Progress.prototype.setText = function setText(text) {
1749
1754
this . text . appendChild ( document . createTextNode ( text ) ) ;
1750
1755
} ;
1751
1756
1752
- Progress . prototype . _createSvgView = function _createSvgView ( opts ) {
1757
+ Shape . prototype . _createSvgView = function _createSvgView ( opts ) {
1753
1758
var svg = document . createElementNS ( 'http://www.w3.org/2000/svg' , 'svg' ) ;
1754
1759
this . _initializeSvg ( svg , opts ) ;
1755
1760
@@ -1771,16 +1776,16 @@ Progress.prototype._createSvgView = function _createSvgView(opts) {
1771
1776
} ;
1772
1777
} ;
1773
1778
1774
- Progress . prototype . _initializeSvg = function _initializeSvg ( svg , opts ) {
1779
+ Shape . prototype . _initializeSvg = function _initializeSvg ( svg , opts ) {
1775
1780
svg . setAttribute ( 'viewBox' , '0 0 100 100' ) ;
1776
1781
} ;
1777
1782
1778
- Progress . prototype . _createPath = function _createPath ( opts ) {
1783
+ Shape . prototype . _createPath = function _createPath ( opts ) {
1779
1784
var pathString = this . _pathString ( opts ) ;
1780
1785
return this . _createPathElement ( pathString , opts ) ;
1781
1786
} ;
1782
1787
1783
- Progress . prototype . _createTrail = function _createTrail ( opts ) {
1788
+ Shape . prototype . _createTrail = function _createTrail ( opts ) {
1784
1789
// Create path string with original passed options
1785
1790
var pathString = this . _trailString ( opts ) ;
1786
1791
@@ -1801,7 +1806,7 @@ Progress.prototype._createTrail = function _createTrail(opts) {
1801
1806
return this . _createPathElement ( pathString , newOpts ) ;
1802
1807
} ;
1803
1808
1804
- Progress . prototype . _createPathElement = function _createPathElement ( pathString , opts ) {
1809
+ Shape . prototype . _createPathElement = function _createPathElement ( pathString , opts ) {
1805
1810
var path = document . createElementNS ( 'http://www.w3.org/2000/svg' , 'path' ) ;
1806
1811
path . setAttribute ( 'd' , pathString ) ;
1807
1812
path . setAttribute ( 'stroke' , opts . color ) ;
@@ -1816,7 +1821,7 @@ Progress.prototype._createPathElement = function _createPathElement(pathString,
1816
1821
return path ;
1817
1822
} ;
1818
1823
1819
- Progress . prototype . _createTextElement = function _createTextElement ( opts , container ) {
1824
+ Shape . prototype . _createTextElement = function _createTextElement ( opts , container ) {
1820
1825
var element = document . createElement ( 'p' ) ;
1821
1826
element . appendChild ( document . createTextNode ( opts . text . value ) ) ;
1822
1827
@@ -1841,20 +1846,20 @@ Progress.prototype._createTextElement = function _createTextElement(opts, contai
1841
1846
return element ;
1842
1847
} ;
1843
1848
1844
- Progress . prototype . _pathString = function _pathString ( opts ) {
1849
+ Shape . prototype . _pathString = function _pathString ( opts ) {
1845
1850
throw new Error ( 'Override this function for each progress bar' ) ;
1846
1851
} ;
1847
1852
1848
- Progress . prototype . _trailString = function _trailString ( opts ) {
1853
+ Shape . prototype . _trailString = function _trailString ( opts ) {
1849
1854
throw new Error ( 'Override this function for each progress bar' ) ;
1850
1855
} ;
1851
1856
1852
- module . exports = Progress ;
1857
+ module . exports = Shape ;
1853
1858
1854
1859
} , { "./path" :5 , "./utils" :8 } ] , 7 :[ function ( require , module , exports ) {
1855
1860
// Square shaped progress bar
1856
1861
1857
- var Progress = require ( './progress ' ) ;
1862
+ var Shape = require ( './shape ' ) ;
1858
1863
var utils = require ( './utils' ) ;
1859
1864
1860
1865
@@ -1873,10 +1878,10 @@ var Square = function Square(container, options) {
1873
1878
' L {halfOfStrokeWidth},{width}' +
1874
1879
' L {halfOfStrokeWidth},{halfOfStrokeWidth}' ;
1875
1880
1876
- Progress . apply ( this , arguments ) ;
1881
+ Shape . apply ( this , arguments ) ;
1877
1882
} ;
1878
1883
1879
- Square . prototype = new Progress ( ) ;
1884
+ Square . prototype = new Shape ( ) ;
1880
1885
Square . prototype . constructor = Square ;
1881
1886
1882
1887
Square . prototype . _pathString = function _pathString ( opts ) {
@@ -1902,7 +1907,7 @@ Square.prototype._trailString = function _trailString(opts) {
1902
1907
1903
1908
module . exports = Square ;
1904
1909
1905
- } , { "./progress " :6 , "./utils" :8 } ] , 8 :[ function ( require , module , exports ) {
1910
+ } , { "./shape " :6 , "./utils" :8 } ] , 8 :[ function ( require , module , exports ) {
1906
1911
// Utility functions
1907
1912
1908
1913
var PREFIXES = 'webkit moz o ms' . split ( ' ' ) ;
0 commit comments