@leafer/canvas-node 1.0.0-beta.2 → 1.0.0-beta.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/canvas-node",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "@leafer/canvas-node",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/canvas": "1.0.0-beta.2"
22
+ "@leafer/canvas": "1.0.0-beta.5"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-beta.2"
25
+ "@leafer/interface": "1.0.0-beta.5"
26
26
  }
27
27
  }
@@ -1,12 +1,13 @@
1
1
  import { ICanvasContext2D, 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()
@@ -21,11 +22,11 @@ export class LeaferCanvas extends LeaferCanvasBase {
21
22
  }
22
23
 
23
24
  protected __createView(): void {
24
- this.view = new Canvas(this.width, this.height)
25
+ this.view = Platform.origin.createCanvas(this.width, this.height)
25
26
  }
26
27
 
27
- public setViewSize(size: IScreenSizeData): void {
28
- const { width, height, pixelRatio } = size
28
+ public updateViewSize(): void {
29
+ const { width, height, pixelRatio } = this
29
30
 
30
31
  this.view.width = width * pixelRatio
31
32
  this.view.height = height * pixelRatio