@litecanvas/plugin-migrate 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.js +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
package/dist/dist.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var P={mute:!1};function f(a,c={}){if(c=Object.assign({},P,c),a.stat(1))throw'Plugin Migrate should be loaded before the "init" event';let l=a.stat(0);function n(t,e,s=""){c.mute||console.warn(`[Migrate] warning: ${t} is removed. `+(e?`Use ${e} instead. `:"")+s)}function d(t){return n("seed()","rseed()"),t&&a.rseed(t),a.stat(9)}let p="";function h(t){n("textstyle()","the 5th param of text()"),p=t}let g=a.text;function b(t,e,s,o=3,i=p){g(t,e,s,o,i)}function w(t,e,s,o){n("print()","text()"),b(t,e,s,o)}function y(t,e){n("textmetrics()","ctx().measureText()");let s=a.ctx(),o=a.stat(10),i=a.stat(11);s.font=`${p||""} ${~~(e||o)}px ${i}`;let m=s.measureText(t);return m.height=m.actualBoundingBoxAscent+m.actualBoundingBoxDescent,m}function x(t,e,s,o){n("cliprect()","clip()");let i=a.ctx();i.beginPath(),i.rect(t,e,s,o),i.clip()}function _(t,e,s){n("clipcirc()","clip()");let o=a.ctx();o.beginPath(),o.arc(t,e,s,0,a.TWO_PI),o.clip()}function A(t){n("getcolor()","stat(5)");let e=stat(5);return e[~~t%e.length]}function E(t){n("blendmode()","ctx().globalCompositeOperation");let e=a.ctx();e.globalCompositeOperation=t}function C(t){n("clear()","cls()"),a.cls(t)}function T(t,e,s,o,i,m,X=!0){return n("transform()","ctx().setTransform() or ctx().transform()"),a.ctx()[X?"setTransform":"transform"](t,e,s,o,i,m)}function k(){return n("mousepos()","MX and MY"),[MX,MY]}function M(t){n("setfps()","framerate()"),a.framerate(t)}let r=a.def;function u(t,e){switch(t){case"W":case"WIDTH":r("W",e),r("WIDTH",e);break;case"H":case"HEIGHT":r("H",e),r("HEIGHT",e);break;case"T":case"ELAPSED":r("T",e),r("ELAPSED",e);break;case"CX":case"CENTERX":r("CX",e),r("CENTERX",e);break;case"CY":case"CENTERY":r("CY",e),r("CENTERY",e);break;case"MX":case"MOUSEX":r("MX",e),r("MOUSEX",e);break;case"MY":case"MOUSEY":r("MY",e),r("MOUSEY",e);break;default:r(t,e);break}}function S(t,e){n("setvar()","def()"),u(t,e)}function Y(t,e){if(l.autoscale)throw"resize() don't works with autoscale enabled";n("resize()",null,"Avoid changing the canvas dimensions at runtime."),a.CANVAS.width=t,u("W",t),u("CX",t/2),a.CANVAS.height=e,u("H",e),u("CY",e/2),a.emit("resized",1)}for(let t of["W","H","T","CX","CY","MX","MY"])a[t]!=null&&u(t,a[t]);if(n("FPS","some library to measure the FPS","Recommendation: https://github.com/mrdoob/stats.js/"),r("FPS",""),l.fps&&a.framerate(l.fps),l.background>=0){let t=stat(5);a.CANVAS.style.backgroundColor=t[~~l.background%t.length]}return{def:u,seed:d,print:w,clear:C,setfps:M,setvar:S,textstyle:h,textmetrics:y,text:b,cliprect:x,clipcirc:_,blendmode:E,transform:T,getcolor:A,mousepos:k,resize:Y}}window.pluginMigrate=f;})();
|
|
2
2
|
/*! pluginMigrate for litecanvas v0.0.1 by Luiz Bills | MIT Licensed */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litecanvas/plugin-migrate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Sometimes upgrading litecanvas to a new version can be a lot of work. This plugin makes this easier, by restoring the Litecanvas APIs that were removed in newer versions, and additionally shows warnings in the browser console when removed and/or deprecated APIs are used.",
|
|
5
5
|
"author": "Luiz Bills <luizbills@pm.me>",
|
|
6
6
|
"license": "MIT",
|
package/src/index.js
CHANGED