{"version":3,"file":"anim_progress_bar.min.js","sources":["../src/anim_progress_bar.js"],"sourcesContent":["/* jshint ignore:start */\ndefine(['jquery', 'core/log'], function ($, log) {\n\n    \"use strict\"; // jshint ;_;\n\n    log.debug('Bar Progress: initialising');\n\n    return {\n\n        playcanvas: null,\n        context: null,\n        startx: null,\n        starty: null,\n        barwidth: null,\n        barheight: null,\n        enabled: false,\n        drawparams: {\n            barColor: \"#C2C2C2\",\n            textColor: '#0',\n            font: '12px Arial',\n            textAlign: \"center\"\n        },\n\n\n        //for making multiple instances\n        clone: function () {\n            return $.extend(true, {}, this);\n        },\n\n        //pass in config, the jquery video/audio object, and a function to be called when conversion has finshed\n        init: function (playcanvas) {\n            //stash the key actors for calling from draw\n            this.playcanvas = playcanvas.get(0);\n            this.startx = 0;\n            this.starty = 0;\n            this.barwidth = this.playcanvas.width;\n            this.barheight = this.playcanvas.height;\n            this.context = this.playcanvas.getContext('2d');\n        },\n\n        setDrawParam: function (paramkey, paramvalue) {\n            this.drawparams[paramkey] = paramvalue;\n        },\n\n        clear: function () {\n            this.context.clearRect(this.startx, this.starty, this.barwidth, this.barheight);\n        },\n        //this function to be overridden by calling class\n        //0= 0% 1=100%\n        fetchCurrent: function () {\n            return 0;\n        },\n\n        //stop and clear\n        stop: function () {\n            this.enabled = false;\n            this.clear();\n        },\n        //stop without clearing\n        stopthere: function () {\n            this.enabled = false;\n        },\n\n        start: function () {\n            this.clear();\n            this.enabled = true;\n            var that = this;\n            //set draw params, later could make this configurable\n            this.context.textAlign = this.drawparams.textAlign;\n            this.context.font = this.drawparams.font;\n            var textcolor = this.drawparams.textColor;\n\n\n            var draw = function () {\n\n                if (!that.enabled) {\n                    return;\n                }\n                that.clear();\n                that.context.fillStyle = that.drawparams.barColor;\n                that.context.fillRect(that.startx, that.starty, that.fetchCurrent() * that.barwidth, that.barheight);\n\n                //draw text\n                //this distorts unless we set the height and width of the canvas as canvas attributes, and NOT with CSS\n                //that didn't really fit with this, so we use text in the page (ie not canvas)\n                /*\n                that.context.fillStyle = textcolor;\n                that.context.fillText(parseInt(that.fetchCurrent() * 100) +'%',that.barwidth/2, that.barheight/2);\n                */\n                var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||\n                    window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n                requestAnimationFrame(draw);\n\n            }//end of draw\n            draw();\n        }//end of enable\n    };//end of returned object\n});//total end\n"],"names":["define","$","log","debug","playcanvas","context","startx","starty","barwidth","barheight","enabled","drawparams","barColor","textColor","font","textAlign","clone","extend","this","init","get","width","height","getContext","setDrawParam","paramkey","paramvalue","clear","clearRect","fetchCurrent","stop","stopthere","start","that","draw","fillStyle","fillRect","window","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame"],"mappings":"AACAA,yCAAO,CAAC,SAAU,aAAa,SAAUC,EAAGC,YAIxCA,IAAIC,MAAM,8BAEH,CAEHC,WAAY,KACZC,QAAS,KACTC,OAAQ,KACRC,OAAQ,KACRC,SAAU,KACVC,UAAW,KACXC,SAAS,EACTC,WAAY,CACRC,SAAU,UACVC,UAAW,KACXC,KAAM,aACNC,UAAW,UAKfC,MAAO,kBACIf,EAAEgB,QAAO,EAAM,GAAIC,OAI9BC,KAAM,SAAUf,iBAEPA,WAAaA,WAAWgB,IAAI,QAC5Bd,OAAS,OACTC,OAAS,OACTC,SAAWU,KAAKd,WAAWiB,WAC3BZ,UAAYS,KAAKd,WAAWkB,YAC5BjB,QAAUa,KAAKd,WAAWmB,WAAW,OAG9CC,aAAc,SAAUC,SAAUC,iBACzBf,WAAWc,UAAYC,YAGhCC,MAAO,gBACEtB,QAAQuB,UAAUV,KAAKZ,OAAQY,KAAKX,OAAQW,KAAKV,SAAUU,KAAKT,YAIzEoB,aAAc,kBACH,GAIXC,KAAM,gBACGpB,SAAU,OACViB,SAGTI,UAAW,gBACFrB,SAAU,GAGnBsB,MAAO,gBACEL,aACAjB,SAAU,MACXuB,KAAOf,UAENb,QAAQU,UAAYG,KAAKP,WAAWI,eACpCV,QAAQS,KAAOI,KAAKP,WAAWG,KACpBI,KAAKP,WAAWE,cAG5BqB,KAAO,WAEFD,KAAKvB,UAGVuB,KAAKN,QACLM,KAAK5B,QAAQ8B,UAAYF,KAAKtB,WAAWC,SACzCqB,KAAK5B,QAAQ+B,SAASH,KAAK3B,OAAQ2B,KAAK1B,OAAQ0B,KAAKJ,eAAiBI,KAAKzB,SAAUyB,KAAKxB,YAS9D4B,OAAOC,uBAAyBD,OAAOE,0BAC/DF,OAAOG,6BAA+BH,OAAOI,yBAC3BP,QAG1BA"}