@leafer/miniapp 1.0.8 → 1.0.10
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/package.json +5 -5
- package/src/index.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/miniapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "@leafer/miniapp",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.
|
|
26
|
-
"@leafer/canvas-miniapp": "1.0.
|
|
27
|
-
"@leafer/image-miniapp": "1.0.
|
|
25
|
+
"@leafer/core": "1.0.10",
|
|
26
|
+
"@leafer/canvas-miniapp": "1.0.10",
|
|
27
|
+
"@leafer/image-miniapp": "1.0.10"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "1.0.
|
|
30
|
+
"@leafer/interface": "1.0.10"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function useCanvas(_canvasType: ICanvasType, app?: IObject): void {
|
|
|
23
23
|
Platform.origin = {
|
|
24
24
|
createCanvas: (width: number, height: number, _format?: string) => {
|
|
25
25
|
const data = { type: '2d', width, height }
|
|
26
|
-
app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data) // fix: 微信小游戏居然使用的是Screen大写的 wx.createOffScreenCanvas() [踩坑]
|
|
26
|
+
return app.createOffscreenCanvas ? app.createOffscreenCanvas(data) : app.createOffScreenCanvas(data) // fix: 微信小游戏居然使用的是Screen大写的 wx.createOffScreenCanvas() [踩坑]
|
|
27
27
|
},
|
|
28
28
|
canvasToDataURL: (canvas: IObject, type?: IExportImageType, quality?: number) => canvas.toDataURL(mineType(type), quality),
|
|
29
29
|
canvasToBolb: (canvas: IObject, type?: IExportFileType, quality?: number) => canvas.toBuffer(type, { quality }),
|
|
@@ -137,7 +137,7 @@ export function useCanvas(_canvasType: ICanvasType, app?: IObject): void {
|
|
|
137
137
|
|
|
138
138
|
Platform.name = 'miniapp'
|
|
139
139
|
Platform.requestRender = function (render: IFunction): void {
|
|
140
|
-
const { view } =
|
|
140
|
+
const { view } = Platform.renderCanvas || Platform.canvas
|
|
141
141
|
view.requestAnimationFrame ? view.requestAnimationFrame(render) : setTimeout(render, 16) // fix 抖音小程序
|
|
142
142
|
}
|
|
143
143
|
defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, wx.getSystemInfoSync().pixelRatio) } })
|