@leafer-game/miniapp 1.3.3 → 1.4.1

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/miniapp.cjs CHANGED
@@ -68,3 +68,4 @@ Object.keys(find).forEach(function (k) {
68
68
  get: function () { return find[k]; }
69
69
  });
70
70
  });
71
+ //# sourceMappingURL=miniapp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniapp.cjs","sources":["../../../../../../../src/miniapp/src/patch.ts"],"sourcesContent":["\nimport { IMatrixData, ILeaferImagePatternPaint, ICanvasPattern } from '@leafer/interface'\nimport { MatrixHelper, Platform, LeaferImage } from '@leafer/core'\n\n/**\n * android、ios下不支持离屏画布对画\n */\n\n// LeaferCanvas.prototype.__createContext = function () {\n// if (this.viewSelect) {\n// const offscreenView = Platform.origin.createCanvas(1, 1)\n// const context = this.view.getContext('2d')\n\n// this.testView = this.view\n// this.testContext = context\n// this.view = offscreenView\n// }\n\n// this.context = this.view.getContext('2d')\n// this.__bindContext()\n// }\n\n// LeaferCanvas.prototype.updateRender = function (bounds: IBoundsData) {\n// if (this.testView) {\n\n// // 把离屏画布同步到视图画布中: imageData 复制模式 android / ios均有效\n// const { x, y, width, height } = this.bounds.getIntersect(bounds).scale(this.pixelRatio).ceil()\n// let data = this.context.getImageData(x, y, width, height)\n// this.testContext.clearRect(x, y, width, height)\n// this.testContext.putImageData(data, x, y)\n// data = null\n\n// // pattern 下只有 android 有效\n// // let pattern = this.context.createPattern(this.view, Platform.origin.noRepeat)\n// // this.testContext.clearRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern\n// // this.testContext.fillRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern = null\n// }\n// }\n\n// LeaferCanvas.prototype.updateViewSize = function () {\n// const { width, height, pixelRatio, view, testView } = this\n// view.width = width * pixelRatio\n// view.height = height * pixelRatio\n\n// if (testView) {\n// testView.width = view.width\n// testView.height = view.height\n// }\n// }\n\n\n/**\n * ios 下图案填充不能使用离屏画布,改用原图\n */\n\nconst systemInfo = wx.getSystemInfoSync()\nconst platform = systemInfo.platform\n\nif (platform === 'ios') {\n\n LeaferImage.prototype.getPattern = function (canvas: any, repeat: string | null, transform?: IMatrixData, paint?: ILeaferImagePatternPaint): ICanvasPattern {\n //const pattern = Platform.canvas.createPattern(canvas, repeat)\n const pattern = Platform.canvas.createPattern(this.view, repeat)\n\n // 增加使用原图的矩阵\n const { width, height } = canvas\n if (this.width !== width || this.height !== height) {\n if (!transform) transform = MatrixHelper.get()\n MatrixHelper.scale(transform, width / this.width, height / this.height)\n }\n\n try {\n if (transform && pattern.setTransform) {\n pattern.setTransform(transform) // maybe error \n transform = null\n }\n } catch { }\n\n if (paint) paint.transform = transform\n return pattern\n }\n\n}"],"names":["LeaferImage","Platform","MatrixHelper"],"mappings":";;;;;;;;;;AAyDA,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,EAAE;AACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ;AAEpC,IAAI,QAAQ,KAAK,KAAK,EAAE;AAEpB,IAAAA,gBAAW,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,MAAW,EAAE,MAAqB,EAAE,SAAuB,EAAE,KAAgC,EAAA;AAEtI,QAAA,MAAM,OAAO,GAAGC,aAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AAGhE,QAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;AAChC,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;AAChD,YAAA,IAAI,CAAC,SAAS;AAAE,gBAAA,SAAS,GAAGC,iBAAY,CAAC,GAAG,EAAE;AAC9C,YAAAA,iBAAY,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;;AAG3E,QAAA,IAAI;AACA,YAAA,IAAI,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE;AACnC,gBAAA,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;gBAC/B,SAAS,GAAG,IAAI;;;QAEtB,OAAM,EAAA,EAAA;AAER,QAAA,IAAI,KAAK;AAAE,YAAA,KAAK,CAAC,SAAS,GAAG,SAAS;AACtC,QAAA,OAAO,OAAO;AAClB,KAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -29,3 +29,4 @@ if (platform === 'ios') {
29
29
  return pattern;
30
30
  };
31
31
  }
32
+ //# sourceMappingURL=miniapp.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniapp.esm.js","sources":["../../../../../../../src/miniapp/src/patch.ts"],"sourcesContent":["\nimport { IMatrixData, ILeaferImagePatternPaint, ICanvasPattern } from '@leafer/interface'\nimport { MatrixHelper, Platform, LeaferImage } from '@leafer/core'\n\n/**\n * android、ios下不支持离屏画布对画\n */\n\n// LeaferCanvas.prototype.__createContext = function () {\n// if (this.viewSelect) {\n// const offscreenView = Platform.origin.createCanvas(1, 1)\n// const context = this.view.getContext('2d')\n\n// this.testView = this.view\n// this.testContext = context\n// this.view = offscreenView\n// }\n\n// this.context = this.view.getContext('2d')\n// this.__bindContext()\n// }\n\n// LeaferCanvas.prototype.updateRender = function (bounds: IBoundsData) {\n// if (this.testView) {\n\n// // 把离屏画布同步到视图画布中: imageData 复制模式 android / ios均有效\n// const { x, y, width, height } = this.bounds.getIntersect(bounds).scale(this.pixelRatio).ceil()\n// let data = this.context.getImageData(x, y, width, height)\n// this.testContext.clearRect(x, y, width, height)\n// this.testContext.putImageData(data, x, y)\n// data = null\n\n// // pattern 下只有 android 有效\n// // let pattern = this.context.createPattern(this.view, Platform.origin.noRepeat)\n// // this.testContext.clearRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern\n// // this.testContext.fillRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern = null\n// }\n// }\n\n// LeaferCanvas.prototype.updateViewSize = function () {\n// const { width, height, pixelRatio, view, testView } = this\n// view.width = width * pixelRatio\n// view.height = height * pixelRatio\n\n// if (testView) {\n// testView.width = view.width\n// testView.height = view.height\n// }\n// }\n\n\n/**\n * ios 下图案填充不能使用离屏画布,改用原图\n */\n\nconst systemInfo = wx.getSystemInfoSync()\nconst platform = systemInfo.platform\n\nif (platform === 'ios') {\n\n LeaferImage.prototype.getPattern = function (canvas: any, repeat: string | null, transform?: IMatrixData, paint?: ILeaferImagePatternPaint): ICanvasPattern {\n //const pattern = Platform.canvas.createPattern(canvas, repeat)\n const pattern = Platform.canvas.createPattern(this.view, repeat)\n\n // 增加使用原图的矩阵\n const { width, height } = canvas\n if (this.width !== width || this.height !== height) {\n if (!transform) transform = MatrixHelper.get()\n MatrixHelper.scale(transform, width / this.width, height / this.height)\n }\n\n try {\n if (transform && pattern.setTransform) {\n pattern.setTransform(transform) // maybe error \n transform = null\n }\n } catch { }\n\n if (paint) paint.transform = transform\n return pattern\n }\n\n}"],"names":[],"mappings":";;;;;;;;AAyDA,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,EAAE;AACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ;AAEpC,IAAI,QAAQ,KAAK,KAAK,EAAE;AAEpB,IAAA,WAAW,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,MAAW,EAAE,MAAqB,EAAE,SAAuB,EAAE,KAAgC,EAAA;AAEtI,QAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AAGhE,QAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;AAChC,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;AAChD,YAAA,IAAI,CAAC,SAAS;AAAE,gBAAA,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE;AAC9C,YAAA,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;;AAG3E,QAAA,IAAI;AACA,YAAA,IAAI,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE;AACnC,gBAAA,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;gBAC/B,SAAS,GAAG,IAAI;;;QAEtB,OAAM,EAAA,EAAA;AAER,QAAA,IAAI,KAAK;AAAE,YAAA,KAAK,CAAC,SAAS,GAAG,SAAS;AACtC,QAAA,OAAO,OAAO;AAClB,KAAC;AAEL"}
@@ -1 +1,2 @@
1
1
  export*from"@leafer-ui/miniapp";export*from"@leafer-in/robot";export*from"@leafer-in/state";export*from"@leafer-in/animate";export*from"@leafer-in/motion-path";export*from"@leafer-in/find";import{LeaferImage as t,Platform as e,MatrixHelper as r}from"@leafer/core";"ios"===wx.getSystemInfoSync().platform&&(t.prototype.getPattern=function(t,o,i,a){const n=e.canvas.createPattern(this.view,o),{width:f,height:h}=t;this.width===f&&this.height===h||(i||(i=r.get()),r.scale(i,f/this.width,h/this.height));try{i&&n.setTransform&&(n.setTransform(i),i=null)}catch(t){}return a&&(a.transform=i),n});
2
+ //# sourceMappingURL=miniapp.esm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniapp.esm.min.js","sources":["../../../../../../../src/miniapp/src/patch.ts"],"sourcesContent":["\nimport { IMatrixData, ILeaferImagePatternPaint, ICanvasPattern } from '@leafer/interface'\nimport { MatrixHelper, Platform, LeaferImage } from '@leafer/core'\n\n/**\n * android、ios下不支持离屏画布对画\n */\n\n// LeaferCanvas.prototype.__createContext = function () {\n// if (this.viewSelect) {\n// const offscreenView = Platform.origin.createCanvas(1, 1)\n// const context = this.view.getContext('2d')\n\n// this.testView = this.view\n// this.testContext = context\n// this.view = offscreenView\n// }\n\n// this.context = this.view.getContext('2d')\n// this.__bindContext()\n// }\n\n// LeaferCanvas.prototype.updateRender = function (bounds: IBoundsData) {\n// if (this.testView) {\n\n// // 把离屏画布同步到视图画布中: imageData 复制模式 android / ios均有效\n// const { x, y, width, height } = this.bounds.getIntersect(bounds).scale(this.pixelRatio).ceil()\n// let data = this.context.getImageData(x, y, width, height)\n// this.testContext.clearRect(x, y, width, height)\n// this.testContext.putImageData(data, x, y)\n// data = null\n\n// // pattern 下只有 android 有效\n// // let pattern = this.context.createPattern(this.view, Platform.origin.noRepeat)\n// // this.testContext.clearRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern\n// // this.testContext.fillRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern = null\n// }\n// }\n\n// LeaferCanvas.prototype.updateViewSize = function () {\n// const { width, height, pixelRatio, view, testView } = this\n// view.width = width * pixelRatio\n// view.height = height * pixelRatio\n\n// if (testView) {\n// testView.width = view.width\n// testView.height = view.height\n// }\n// }\n\n\n/**\n * ios 下图案填充不能使用离屏画布,改用原图\n */\n\nconst systemInfo = wx.getSystemInfoSync()\nconst platform = systemInfo.platform\n\nif (platform === 'ios') {\n\n LeaferImage.prototype.getPattern = function (canvas: any, repeat: string | null, transform?: IMatrixData, paint?: ILeaferImagePatternPaint): ICanvasPattern {\n //const pattern = Platform.canvas.createPattern(canvas, repeat)\n const pattern = Platform.canvas.createPattern(this.view, repeat)\n\n // 增加使用原图的矩阵\n const { width, height } = canvas\n if (this.width !== width || this.height !== height) {\n if (!transform) transform = MatrixHelper.get()\n MatrixHelper.scale(transform, width / this.width, height / this.height)\n }\n\n try {\n if (transform && pattern.setTransform) {\n pattern.setTransform(transform) // maybe error \n transform = null\n }\n } catch { }\n\n if (paint) paint.transform = transform\n return pattern\n }\n\n}"],"names":["wx","getSystemInfoSync","platform","LeaferImage","prototype","getPattern","canvas","repeat","transform","paint","pattern","Platform","createPattern","this","view","width","height","MatrixHelper","get","scale","setTransform","_a"],"mappings":"wQA4DiB,QAHEA,GAAGC,oBACMC,WAIxBC,EAAYC,UAAUC,WAAa,SAAUC,EAAaC,EAAuBC,EAAyBC,GAEtG,MAAMC,EAAUC,EAASL,OAAOM,cAAcC,KAAKC,KAAMP,IAGnDQ,MAAEA,EAAKC,OAAEA,GAAWV,EACtBO,KAAKE,QAAUA,GAASF,KAAKG,SAAWA,IACnCR,IAAWA,EAAYS,EAAaC,OACzCD,EAAaE,MAAMX,EAAWO,EAAQF,KAAKE,MAAOC,EAASH,KAAKG,SAGpE,IACQR,GAAaE,EAAQU,eACrBV,EAAQU,aAAaZ,GACrBA,EAAY,MAElB,MAAMa,GAAA,CAGR,OADIZ,IAAOA,EAAMD,UAAYA,GACtBE,CACV"}
@@ -1 +1,2 @@
1
1
  "use strict";var e=require("@leafer-ui/miniapp"),t=require("@leafer-in/robot"),r=require("@leafer-in/state"),n=require("@leafer-in/animate"),o=require("@leafer-in/motion-path"),a=require("@leafer-in/find"),i=require("@leafer/core");"ios"===wx.getSystemInfoSync().platform&&(i.LeaferImage.prototype.getPattern=function(e,t,r,n){const o=i.Platform.canvas.createPattern(this.view,t),{width:a,height:c}=e;this.width===a&&this.height===c||(r||(r=i.MatrixHelper.get()),i.MatrixHelper.scale(r,a/this.width,c/this.height));try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(e){}return n&&(n.transform=r),o}),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})})),Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(r).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})})),Object.keys(n).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})})),Object.keys(o).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return o[e]}})})),Object.keys(a).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return a[e]}})}));
2
+ //# sourceMappingURL=miniapp.min.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniapp.min.cjs","sources":["../../../../../../../src/miniapp/src/patch.ts"],"sourcesContent":["\nimport { IMatrixData, ILeaferImagePatternPaint, ICanvasPattern } from '@leafer/interface'\nimport { MatrixHelper, Platform, LeaferImage } from '@leafer/core'\n\n/**\n * android、ios下不支持离屏画布对画\n */\n\n// LeaferCanvas.prototype.__createContext = function () {\n// if (this.viewSelect) {\n// const offscreenView = Platform.origin.createCanvas(1, 1)\n// const context = this.view.getContext('2d')\n\n// this.testView = this.view\n// this.testContext = context\n// this.view = offscreenView\n// }\n\n// this.context = this.view.getContext('2d')\n// this.__bindContext()\n// }\n\n// LeaferCanvas.prototype.updateRender = function (bounds: IBoundsData) {\n// if (this.testView) {\n\n// // 把离屏画布同步到视图画布中: imageData 复制模式 android / ios均有效\n// const { x, y, width, height } = this.bounds.getIntersect(bounds).scale(this.pixelRatio).ceil()\n// let data = this.context.getImageData(x, y, width, height)\n// this.testContext.clearRect(x, y, width, height)\n// this.testContext.putImageData(data, x, y)\n// data = null\n\n// // pattern 下只有 android 有效\n// // let pattern = this.context.createPattern(this.view, Platform.origin.noRepeat)\n// // this.testContext.clearRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern\n// // this.testContext.fillRect(0, 0, this.view.width, this.view.height)\n// // this.testContext.fillStyle = pattern = null\n// }\n// }\n\n// LeaferCanvas.prototype.updateViewSize = function () {\n// const { width, height, pixelRatio, view, testView } = this\n// view.width = width * pixelRatio\n// view.height = height * pixelRatio\n\n// if (testView) {\n// testView.width = view.width\n// testView.height = view.height\n// }\n// }\n\n\n/**\n * ios 下图案填充不能使用离屏画布,改用原图\n */\n\nconst systemInfo = wx.getSystemInfoSync()\nconst platform = systemInfo.platform\n\nif (platform === 'ios') {\n\n LeaferImage.prototype.getPattern = function (canvas: any, repeat: string | null, transform?: IMatrixData, paint?: ILeaferImagePatternPaint): ICanvasPattern {\n //const pattern = Platform.canvas.createPattern(canvas, repeat)\n const pattern = Platform.canvas.createPattern(this.view, repeat)\n\n // 增加使用原图的矩阵\n const { width, height } = canvas\n if (this.width !== width || this.height !== height) {\n if (!transform) transform = MatrixHelper.get()\n MatrixHelper.scale(transform, width / this.width, height / this.height)\n }\n\n try {\n if (transform && pattern.setTransform) {\n pattern.setTransform(transform) // maybe error \n transform = null\n }\n } catch { }\n\n if (paint) paint.transform = transform\n return pattern\n }\n\n}"],"names":["wx","getSystemInfoSync","platform","LeaferImage","prototype","getPattern","canvas","repeat","transform","paint","pattern","Platform","createPattern","this","view","width","height","MatrixHelper","get","scale","setTransform","_a"],"mappings":"wOA4DiB,QAHEA,GAAGC,oBACMC,WAIxBC,EAAWA,YAACC,UAAUC,WAAa,SAAUC,EAAaC,EAAuBC,EAAyBC,GAEtG,MAAMC,EAAUC,EAAAA,SAASL,OAAOM,cAAcC,KAAKC,KAAMP,IAGnDQ,MAAEA,EAAKC,OAAEA,GAAWV,EACtBO,KAAKE,QAAUA,GAASF,KAAKG,SAAWA,IACnCR,IAAWA,EAAYS,EAAYA,aAACC,OACzCD,eAAaE,MAAMX,EAAWO,EAAQF,KAAKE,MAAOC,EAASH,KAAKG,SAGpE,IACQR,GAAaE,EAAQU,eACrBV,EAAQU,aAAaZ,GACrBA,EAAY,MAElB,MAAMa,GAAA,CAGR,OADIZ,IAAOA,EAAMD,UAAYA,GACtBE,CACV"}