@leafer/canvas-web 1.0.0-beta.4 → 1.0.0-beta.6

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-web",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "@leafer/canvas-web",
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.4",
23
- "@leafer/math": "1.0.0-beta.4",
24
- "@leafer/data": "1.0.0-beta.4",
25
- "@leafer/event": "1.0.0-beta.4",
26
- "@leafer/debug": "1.0.0-beta.4"
22
+ "@leafer/canvas": "1.0.0-beta.6",
23
+ "@leafer/math": "1.0.0-beta.6",
24
+ "@leafer/data": "1.0.0-beta.6",
25
+ "@leafer/event": "1.0.0-beta.6",
26
+ "@leafer/debug": "1.0.0-beta.6"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.0-beta.4"
29
+ "@leafer/interface": "1.0.0-beta.6"
30
30
  }
31
31
  }
@@ -33,15 +33,11 @@ export class LeaferCanvas extends LeaferCanvasBase {
33
33
  if (!this.autoLayout) this.resize(this.config as IScreenSizeData)
34
34
  }
35
35
 
36
- public setBackgroundColor(color: string): void {
37
- const view = this.view as HTMLElement
38
- view.style.backgroundColor = color
39
- }
36
+ public set backgroundColor(color: string) { (this.view as HTMLElement).style.backgroundColor = color }
37
+ public get backgroundColor(): string { return (this.view as HTMLElement).style.backgroundColor }
40
38
 
41
- public setHittable(hittable: boolean): void {
42
- const view = this.view as HTMLElement
43
- view.style.pointerEvents = hittable ? 'auto' : 'none'
44
- }
39
+ public set hittable(hittable: boolean) { (this.view as HTMLElement).style.pointerEvents = hittable ? 'auto' : 'none' }
40
+ public get hittable() { return (this.view as HTMLElement).style.pointerEvents !== 'none' }
45
41
 
46
42
  protected __createContext(): void {
47
43
  this.context = this.view.getContext('2d') as ICanvasContext2D
@@ -97,8 +93,8 @@ export class LeaferCanvas extends LeaferCanvasBase {
97
93
  }
98
94
  }
99
95
 
100
- public setViewSize(size: IScreenSizeData): void {
101
- const { width, height, pixelRatio } = size
96
+ public updateViewSize(): void {
97
+ const { width, height, pixelRatio } = this
102
98
 
103
99
  if (!this.offscreen) {
104
100
  const { style } = this.view as HTMLCanvasElement