@leafer/canvas-worker 1.0.0-beta.12 → 1.0.0-beta.15

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,12 +1,14 @@
1
1
  {
2
2
  "name": "@leafer/canvas-worker",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "@leafer/canvas-worker",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "main": "src/index.ts",
8
+ "types": "types/index.d.ts",
8
9
  "files": [
9
- "src"
10
+ "types",
11
+ "dist"
10
12
  ],
11
13
  "repository": {
12
14
  "type": "git",
@@ -19,10 +21,9 @@
19
21
  "leaferjs"
20
22
  ],
21
23
  "dependencies": {
22
- "@leafer/platform": "1.0.0-beta.12",
23
- "@leafer/canvas": "1.0.0-beta.12"
24
+ "@leafer/core": "1.0.0-beta.15"
24
25
  },
25
26
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-beta.12"
27
+ "@leafer/interface": "1.0.0-beta.15"
27
28
  }
28
29
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { canvasPatch } from '@leafer/canvas'
1
+ import { canvasPatch } from '@leafer/core'
2
2
 
3
3
  export { LeaferCanvas } from './LeaferCanvas'
4
4
 
@@ -0,0 +1,11 @@
1
+ import { LeaferCanvasBase } from '@leafer/core';
2
+
3
+ declare class LeaferCanvas extends LeaferCanvasBase {
4
+ view: OffscreenCanvas;
5
+ get allowBackgroundColor(): boolean;
6
+ init(): void;
7
+ protected __createView(): void;
8
+ updateViewSize(): void;
9
+ }
10
+
11
+ export { LeaferCanvas };
@@ -1,32 +0,0 @@
1
- import { IObject, IScreenSizeData } from '@leafer/interface'
2
- import { LeaferCanvasBase } from '@leafer/canvas'
3
- import { Platform } from '@leafer/platform'
4
-
5
- export class LeaferCanvas extends LeaferCanvasBase {
6
-
7
- public view: IObject
8
-
9
- public get allowBackgroundColor(): boolean { return true }
10
-
11
- public init(): void {
12
-
13
- this.__createView()
14
- this.__createContext()
15
-
16
- this.resize(this.config as IScreenSizeData)
17
- }
18
-
19
- protected __createView(): void {
20
- this.view = Platform.origin.createCanvas(1, 1)
21
- }
22
-
23
- public updateViewSize(): void {
24
- const { width, height, pixelRatio } = this
25
-
26
- this.view.width = width * pixelRatio
27
- this.view.height = height * pixelRatio
28
-
29
- this.clientBounds = this.bounds
30
- }
31
-
32
- }