@leafer/canvas-node 1.0.0-beta → 1.0.0-beta.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 +4 -3
- package/src/LeaferCanvas.ts +9 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas-node",
|
|
3
|
-
"version": "1.0.0-beta",
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "@leafer/canvas-node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/
|
|
22
|
+
"@leafer/platform": "1.0.0-beta.10",
|
|
23
|
+
"@leafer/canvas": "1.0.0-beta.10"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-beta"
|
|
26
|
+
"@leafer/interface": "1.0.0-beta.10"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/src/LeaferCanvas.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IObject, IScreenSizeData } from '@leafer/interface'
|
|
2
2
|
import { LeaferCanvasBase } from '@leafer/canvas'
|
|
3
|
-
|
|
4
|
-
import { Canvas } from 'skia-canvas'
|
|
3
|
+
import { Platform } from '@leafer/platform'
|
|
5
4
|
|
|
6
5
|
export class LeaferCanvas extends LeaferCanvasBase {
|
|
7
6
|
|
|
8
7
|
public view: IObject
|
|
9
8
|
|
|
9
|
+
public get allowBackgroundColor(): boolean { return false }
|
|
10
|
+
|
|
10
11
|
public init(): void {
|
|
11
12
|
|
|
12
13
|
this.__createView()
|
|
@@ -15,20 +16,17 @@ export class LeaferCanvas extends LeaferCanvasBase {
|
|
|
15
16
|
this.resize(this.config as IScreenSizeData)
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
protected __createContext(): void {
|
|
19
|
-
this.context = this.view.getContext('2d') as unknown as ICanvasContext2D
|
|
20
|
-
this.__bindContext()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
protected __createView(): void {
|
|
24
|
-
this.view =
|
|
20
|
+
this.view = Platform.origin.createCanvas(1, 1)
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
public
|
|
28
|
-
const { width, height, pixelRatio } =
|
|
23
|
+
public updateViewSize(): void {
|
|
24
|
+
const { width, height, pixelRatio } = this
|
|
29
25
|
|
|
30
26
|
this.view.width = width * pixelRatio
|
|
31
27
|
this.view.height = height * pixelRatio
|
|
28
|
+
|
|
29
|
+
this.clientBounds = this.bounds
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
}
|