@leafer/canvas-miniapp 1.0.0-beta.8 → 1.0.0-beta.9
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 +7 -7
- package/src/LeaferCanvas.ts +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas-miniapp",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"description": "@leafer/canvas-miniapp",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/canvas": "1.0.0-beta.
|
|
23
|
-
"@leafer/data": "1.0.0-beta.
|
|
24
|
-
"@leafer/event": "1.0.0-beta.
|
|
25
|
-
"@leafer/platform": "1.0.0-beta.
|
|
26
|
-
"@leafer/debug": "1.0.0-beta.
|
|
22
|
+
"@leafer/canvas": "1.0.0-beta.9",
|
|
23
|
+
"@leafer/data": "1.0.0-beta.9",
|
|
24
|
+
"@leafer/event": "1.0.0-beta.9",
|
|
25
|
+
"@leafer/platform": "1.0.0-beta.9",
|
|
26
|
+
"@leafer/debug": "1.0.0-beta.9"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.0.0-beta.
|
|
29
|
+
"@leafer/interface": "1.0.0-beta.9"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/LeaferCanvas.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IResizeEventListener, IAutoBounds, IScreenSizeData, IFunction, IMiniappSelect } from '@leafer/interface'
|
|
2
|
-
import { LeaferCanvasBase, canvasSizeAttrs } from '@leafer/canvas'
|
|
1
|
+
import { IResizeEventListener, IAutoBounds, IScreenSizeData, IFunction, IMiniappSelect, IObject } from '@leafer/interface'
|
|
2
|
+
import { LeaferCanvasBase, canvasPatch, canvasSizeAttrs } from '@leafer/canvas'
|
|
3
3
|
import { Platform } from '@leafer/platform'
|
|
4
4
|
import { DataHelper } from '@leafer/data'
|
|
5
5
|
import { ResizeEvent } from '@leafer/event'
|
|
@@ -31,17 +31,27 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
protected initView(view?:
|
|
34
|
+
protected initView(view?: IObject): void {
|
|
35
35
|
if (!view) {
|
|
36
36
|
view = {}
|
|
37
37
|
this.__createView()
|
|
38
38
|
} else {
|
|
39
39
|
this.view = view.view || view
|
|
40
|
+
Platform.canvas = this
|
|
40
41
|
}
|
|
41
42
|
this.__createContext()
|
|
42
43
|
const { width, height, pixelRatio } = this.config
|
|
43
44
|
const size = { width: width || view.width, height: height || view.height, pixelRatio }
|
|
44
45
|
this.resize(size)
|
|
46
|
+
|
|
47
|
+
// fix roundRect
|
|
48
|
+
if (this.context.roundRect) {
|
|
49
|
+
this.roundRect = function (x: number, y: number, width: number, height: number, radius?: number | number[]): void {
|
|
50
|
+
this.context.roundRect(x, y, width, height, typeof radius === 'number' ? [radius] : radius)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
canvasPatch((this.context as IObject).__proto__)
|
|
54
|
+
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
protected __createView(): void {
|
|
@@ -95,5 +105,4 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
95
105
|
Platform.miniapp.offWindowResize(this.checkSize)
|
|
96
106
|
}
|
|
97
107
|
|
|
98
|
-
|
|
99
108
|
}
|