{"version":3,"sources":["webpack:///webpack/bootstrap a5faea3048cbee9b9169","webpack:///./src/index.js","webpack:///./src/helper.js"],"names":["helper","require","RadialBar","constructor","ctx","config","styles","PERCENT_DEG","isStop","progress","degProgress","isShowInfoText","_roundProgress","Math","ceil","x","y","radius","lineWidth","angle","lineFill","backLineFill","bgFill","infoStyle","infoColor","set","p","saveProgress","subtract","add","get","floor","showInfoText","save","fillStyle","textAlign","textBaseline","font","fillText","restore","update","translate","rotate","toRad","beginPath","arc","PI","fill","strokeStyle","stroke","module","exports","deg"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA,OAAMA,SAAS,mBAAAC,CAAQ,CAAR,CAAf;;AAEA,OAAMC,SAAN,CAAgB;AACfC,cAAYC,GAAZ,EAAiBC,SAAS,EAA1B,EAA8B;AAC7B,QAAKD,GAAL,GAAWA,GAAX;AACA,QAAKE,MAAL,CAAYD,MAAZ;;AAEA;AACA,QAAKE,WAAL,GAAmB,MAAI,GAAvB;;AAEA;AACA,QAAKC,MAAL,GAAc,KAAd;AACA,QAAKC,QAAL,GAAgBJ,OAAOI,QAAP,IAAmB,CAAnC;AACA,QAAKC,WAAL,GAAmB,KAAKD,QAAL,GAAc,KAAKF,WAAtC;AACA,QAAKI,cAAL,GAAsBN,OAAOM,cAAP,IAAyB,IAAzB,GAAgC,IAAhC,GAAuCN,OAAOM,cAApE;AACA;;AAEDC,mBAAiB;AAChB,QAAKF,WAAL,GAAmBG,KAAKC,IAAL,CAAW,KAAKJ,WAAN,GAAmB,GAA7B,IAAkC,GAArD;AACA,QAAKD,QAAL,GAAgBI,KAAKC,IAAL,CAAW,KAAKL,QAAN,GAAgB,GAA1B,IAA+B,GAA/C;AACA;;AAEDH,SAAOD,MAAP,EAAe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AKA,SAA1B;;AAEA,QAAKd,GAAL,CAAS8B,SAAT,GAAqB,KAAKZ,MAA1B;AACA,QAAKlB,GAAL,CAASwC,SAAT;AACA,QAAKxC,GAAL,CAASyC,GAAT,CAAa,CAAb,EAAgB,CAAhB,EAAmB,KAAK5B,MAAxB,EAAgC,CAAhC,EAAmC,IAAEJ,KAAKiC,EAA1C;AACA,QAAK1C,GAAL,CAAS2C,IAAT;;AAEA,QAAK3C,GAAL,CAAS4C,WAAT,GAAuB,KAAK3B,YAA5B;AACA,QAAKjB,GAAL,CAASwC,SAAT;AACA,QAAKxC,GAAL,CAASyC,GAAT,CAAa,CAAb,EAAgB,CAAhB,EAAmB,KAAK5B,MAAxB,EAAgC,CAAhC,EAAmC,IAAEJ,KAAKiC,EAA1C;AACA,QAAK1C,GAAL,CAAS6C,MAAT;;AAEA,QAAK7C,GAAL,CAAS4C,WAAT,GAAuB,KAAK5B,QAA5B;AACA,QAAKhB,GAAL,CAASwC,SAAT;AACA,QAAKxC,GAAL,CAASyC,GAAT,CAAa,CAAb,EAAgB,CAAhB,EAAmB,KAAK5B,MAAxB,EAAgC,CAAhC,EAAmCjB,OAAO2C,KAAP,CAAa,KAAKjC,WAAlB,CAAnC,EAAmE,IAAnE;AACA,QAAKN,GAAL,CAAS6C,MAAT;;AAED,QAAK7C,GAAL,CAASmC,OAAT;;AAEA,OAAG,KAAK5B,cAAR,EAAwB,KAAKqB,YAAL;AACxB;AAlIc;;AAqIhBkB,QAAOC,OAAP,GAAiBjD,SAAjB,C;;;;;;ACvIA,KAAIF,SAAS;AACZ2C,SAAO,UAASS,GAAT,EAAc;AACpB,UAAOA,MAAMvC,KAAKiC,EAAX,GAAc,GAArB;AACA;AAHW,EAAb;;AAMAI,QAAOC,OAAP,GAAiBnD,MAAjB,C","file":"RadialBar.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap a5faea3048cbee9b9169\n **/","const helper = require('./helper.js');\r\n\r\nclass RadialBar {\r\n\tconstructor(ctx, config = {}) {\r\n\t\tthis.ctx = ctx;\r\n\t\tthis.styles(config);\r\n\r\n\t\t// const\r\n\t\tthis.PERCENT_DEG = 360/100;\r\n\r\n\t\t// progress bar\r\n\t\tthis.isStop = false;\r\n\t\tthis.progress = config.progress || 0;\r\n\t\tthis.degProgress = this.progress*this.PERCENT_DEG;\r\n\t\tthis.isShowInfoText = config.isShowInfoText == null ? true : config.isShowInfoText;\r\n\t}\r\n\r\n\t_roundProgress() {\r\n\t\tthis.degProgress = Math.ceil((this.degProgress)*100)/100;\r\n\t\tthis.progress = Math.ceil((this.progress)*100)/100;\r\n\t}\r\n\r\n\tstyles(config) {\r\n\t\t// pos\r\n\t\tthis.x = config.x || 0;\r\n\t\tthis.y = config.y || 0;\r\n\r\n\t\t// style\r\n\t\tthis.radius = config.radius == null ? 50 : config.radius;\r\n\t\tthis.lineWidth = config.lineWidth == null ? 10 : config.lineWidth;\r\n\r\n\t\tthis.angle = config.angle || 0;\r\n\r\n\t\tthis.lineFill = config.lineFill || '#fff';\r\n\r\n\t\tthis.backLineFill = config.backLineFill || 'transparent';\r\n\t\tthis.bgFill = config.bgFill || 'transparent';\r\n\r\n\t\tthis.infoStyle = config.infoStyle || '24px Arial';\r\n\t\tthis.infoColor = config.infoColor || '#000';\r\n\r\n\t\tthis.isStop = config.isStop == null ? false : config.isStop;\r\n\t}\r\n\r\n\tset(p) {\r\n\t\tif(!this.isStop) {\r\n\t\t\tthis.saveProgress = this.progress;\r\n\t\t\tthis.degProgress = p*this.PERCENT_DEG;\r\n\t\t\tthis.progress = p;\r\n\r\n\t\t\tthis._roundProgress();\r\n\t\t}\r\n\t}\r\n\tsubtract(p) {\r\n\t\tif(!this.isStop) {\r\n\t\t\tthis.saveProgress = this.progress;\r\n\t\t\tthis.degProgress -= p*this.PERCENT_DEG;\r\n\t\t\tthis.progress -= p;\r\n\r\n\t\t\tthis._roundProgress();\r\n\r\n\t\t\tif(this.progress < 0) {\r\n\t\t\t\tthis.progress = 0;\r\n\t\t\t\tthis.degProgress = 0.01;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tadd(p) {\r\n\t\tif(!this.isStop) {\r\n\t\t\tthis.saveProgress = this.progress;\r\n\t\t\tthis.degProgress += p*this.PERCENT_DEG;\r\n\t\t\tthis.progress += p;\r\n\r\n\t\t\tthis._roundProgress();\r\n\r\n\t\t\tif(this.progress > 100) {\r\n\t\t\t\tthis.progress = 100;\r\n\t\t\t\tthis.degProgress = 359.99;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// stop(p) {\r\n\t// \tif(this.progress !== this.saveProgress) this.isStop = true;\r\n\t// \tconsole.log(this.progress, this.saveProgress);\r\n\t// }\r\n\t// start(p) {\r\n\t// \tif(this.progress !== this.saveProgress) this.isStop = false;\r\n\t// }\r\n\t// toggleStop(p) {\r\n\t// \tif(this.progress !== this.saveProgress) this.isStop = !this.isStop;\r\n\t// }\r\n\r\n\tget(p) {\r\n\t\treturn Math.floor(this.progress);\r\n\t}\r\n\r\n\tshowInfoText(p) {\r\n\t\tthis.ctx.save();\r\n\t\t\tthis.ctx.fillStyle = this.infoColor;\r\n\t\t\tthis.ctx.textAlign = 'center';\r\n\t\t\tthis.ctx.textBaseline = 'middle'; \r\n\t\t\tthis.ctx.font = this.infoStyle;\r\n\r\n\t\t\tthis.ctx.fillText(this.get() + '%', this.x, this.y);\r\n\t\tthis.ctx.restore();\r\n\t}\r\n\r\n\tupdate() {\r\n\t\tthis.ctx.save();\r\n\t\t\tthis.ctx.translate(this.x, this.y);\r\n\t\t\tthis.ctx.rotate(helper.toRad(-90 + this.angle));\r\n\r\n\t\t\tthis.ctx.lineWidth = this.lineWidth;\r\n\r\n\t\t\tthis.ctx.fillStyle = this.bgFill;\r\n\t\t\tthis.ctx.beginPath();\r\n\t\t\tthis.ctx.arc(0, 0, this.radius, 0, 2*Math.PI);\r\n\t\t\tthis.ctx.fill();\r\n\r\n\t\t\tthis.ctx.strokeStyle = this.backLineFill;\r\n\t\t\tthis.ctx.beginPath();\r\n\t\t\tthis.ctx.arc(0, 0, this.radius, 0, 2*Math.PI);\r\n\t\t\tthis.ctx.stroke();\r\n\r\n\t\t\tthis.ctx.strokeStyle = this.lineFill;\r\n\t\t\tthis.ctx.beginPath();\r\n\t\t\tthis.ctx.arc(0, 0, this.radius, 0, helper.toRad(this.degProgress), true);\r\n\t\t\tthis.ctx.stroke();\r\n\r\n\t\tthis.ctx.restore();\r\n\r\n\t\tif(this.isShowInfoText) this.showInfoText();\r\n\t}\r\n}\r\n\r\nmodule.exports = RadialBar;\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","var helper = {\n\ttoRad: function(deg) {\n\t\treturn deg * Math.PI/180\n\t}\n}\n\nmodule.exports = helper;\n\n\n/** WEBPACK FOOTER **\n ** ./src/helper.js\n **/"],"sourceRoot":""}