@leafer/canvas-miniapp 1.8.0 → 1.9.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/package.json +7 -7
- package/src/LeaferCanvas.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas-miniapp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "@leafer/canvas-miniapp",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/canvas": "1.
|
|
26
|
-
"@leafer/data": "1.
|
|
27
|
-
"@leafer/event": "1.
|
|
28
|
-
"@leafer/platform": "1.
|
|
29
|
-
"@leafer/debug": "1.
|
|
25
|
+
"@leafer/canvas": "1.9.1",
|
|
26
|
+
"@leafer/data": "1.9.1",
|
|
27
|
+
"@leafer/event": "1.9.1",
|
|
28
|
+
"@leafer/platform": "1.9.1",
|
|
29
|
+
"@leafer/debug": "1.9.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.
|
|
32
|
+
"@leafer/interface": "1.9.1"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/LeaferCanvas.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IResizeEventListener, IAutoBounds, IScreenSizeData, IFunction, IMiniappSelect, IObject, ICanvasContext2D } from '@leafer/interface'
|
|
2
|
-
import { LeaferCanvasBase, canvasPatch, canvasSizeAttrs, Platform, DataHelper, ResizeEvent } from '@leafer/core'
|
|
2
|
+
import { LeaferCanvasBase, canvasPatch, canvasSizeAttrs, Platform, DataHelper, ResizeEvent, isString, isNumber, isUndefined } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -17,7 +17,7 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
17
17
|
let view = config.view || config.canvas
|
|
18
18
|
|
|
19
19
|
if (view) {
|
|
20
|
-
if (
|
|
20
|
+
if (isString(view)) {
|
|
21
21
|
if (view[0] !== '#') view = '#' + view
|
|
22
22
|
this.viewSelect = Platform.miniapp.select(view)
|
|
23
23
|
} else if (view.fields) {
|
|
@@ -55,7 +55,7 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
55
55
|
// fix roundRect
|
|
56
56
|
if (this.context.roundRect) {
|
|
57
57
|
this.roundRect = function (x: number, y: number, width: number, height: number, radius?: number | number[]): void {
|
|
58
|
-
this.context.roundRect(x, y, width, height,
|
|
58
|
+
this.context.roundRect(x, y, width, height, isNumber(radius) ? [radius] : radius)
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
canvasPatch((this.context as IObject).__proto__)
|
|
@@ -116,7 +116,7 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
116
116
|
const oldSize = {} as IScreenSizeData
|
|
117
117
|
DataHelper.copyAttrs(oldSize, this, canvasSizeAttrs)
|
|
118
118
|
this.resize(size)
|
|
119
|
-
if (this.width
|
|
119
|
+
if (!isUndefined(this.width)) this.resizeListener(new ResizeEvent(size, oldSize))
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
}
|