@leafer/canvas-web 1.8.0 → 1.9.0

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.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "@leafer/canvas-web",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,9 +22,9 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.8.0"
25
+ "@leafer/core": "1.9.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.8.0"
28
+ "@leafer/interface": "1.9.0"
29
29
  }
30
30
  }
@@ -1,5 +1,5 @@
1
1
  import { IAutoBounds, ISizeData, IScreenSizeData, IResizeEventListener, IFunction } from '@leafer/interface'
2
- import { LeaferCanvasBase, canvasSizeAttrs, ResizeEvent, DataHelper, Platform, Debug } from '@leafer/core'
2
+ import { LeaferCanvasBase, canvasSizeAttrs, ResizeEvent, DataHelper, Platform, Debug, isString, isUndefined } from '@leafer/core'
3
3
 
4
4
 
5
5
  const debug = Debug.get('LeaferCanvas')
@@ -68,7 +68,7 @@ export class LeaferCanvas extends LeaferCanvasBase {
68
68
  }
69
69
 
70
70
  protected __createViewFrom(inputView: string | object): void {
71
- let find: unknown = (typeof inputView === 'string') ? document.getElementById(inputView) : inputView as HTMLElement
71
+ let find: unknown = isString(inputView) ? document.getElementById(inputView) : inputView as HTMLElement
72
72
  if (find) {
73
73
  if (find instanceof HTMLCanvasElement) {
74
74
 
@@ -196,7 +196,7 @@ export class LeaferCanvas extends LeaferCanvasBase {
196
196
  const oldSize = {} as IScreenSizeData
197
197
  DataHelper.copyAttrs(oldSize, this, canvasSizeAttrs)
198
198
  this.resize(size)
199
- if (this.resizeListener && this.width !== undefined) this.resizeListener(new ResizeEvent(size, oldSize))
199
+ if (this.resizeListener && !isUndefined(this.width)) this.resizeListener(new ResizeEvent(size, oldSize))
200
200
  }
201
201
 
202
202