@leafer/canvas 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",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "@leafer/canvas",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,15 +22,15 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/file": "1.8.0",
26
- "@leafer/list": "1.8.0",
27
- "@leafer/math": "1.8.0",
28
- "@leafer/data": "1.8.0",
29
- "@leafer/path": "1.8.0",
30
- "@leafer/debug": "1.8.0",
31
- "@leafer/platform": "1.8.0"
25
+ "@leafer/file": "1.9.0",
26
+ "@leafer/list": "1.9.0",
27
+ "@leafer/math": "1.9.0",
28
+ "@leafer/data": "1.9.0",
29
+ "@leafer/path": "1.9.0",
30
+ "@leafer/debug": "1.9.0",
31
+ "@leafer/platform": "1.9.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@leafer/interface": "1.8.0"
34
+ "@leafer/interface": "1.9.0"
35
35
  }
36
36
  }
package/src/Canvas.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { ICanvasAttr, ITextMetrics, ICanvasContext2D, IPath2D, IObject, InnerId, IMatrixData, IFunction, IWindingRule, IBlendMode } from '@leafer/interface'
2
+ import { isObject } from '@leafer/data'
3
+
2
4
 
3
5
  function contextAttr(realName?: string) {
4
6
  return (target: Canvas, key: string) => {
@@ -155,7 +157,7 @@ export class Canvas implements ICanvasAttr {
155
157
  public restore(): void { }
156
158
 
157
159
  public transform(a: number | IMatrixData, b?: number, c?: number, d?: number, e?: number, f?: number): void {
158
- if (typeof a === 'object') {
160
+ if (isObject(a)) {
159
161
  this.context.transform(a.a, a.b, a.c, a.d, a.e, a.f)
160
162
  } else {
161
163
  this.context.transform(a, b, c, d, e, f)
@@ -1,7 +1,7 @@
1
1
  import { IBounds, ILeaferCanvas, ICanvasStrokeOptions, ILeaferCanvasConfig, IWindingRuleData, IExportOptions, IMatrixData, IBoundsData, IAutoBounds, IScreenSizeData, IResizeEventListener, IMatrixWithBoundsData, IPointData, InnerId, ICanvasManager, IWindingRule, IBlendMode, IExportImageType, IExportFileType, IBlob, ICursorType, ILeaferCanvasView, IRadiusPointData, IObject, IMatrixWithOptionHalfData } from '@leafer/interface'
2
2
  import { Bounds, tempBounds, BoundsHelper, MatrixHelper, IncrementId } from '@leafer/math'
3
3
  import { Creator, Platform } from '@leafer/platform'
4
- import { DataHelper } from '@leafer/data'
4
+ import { DataHelper, isUndefined } from '@leafer/data'
5
5
 
6
6
  import { Canvas } from './Canvas'
7
7
 
@@ -166,8 +166,8 @@ export class LeaferCanvasBase extends Canvas implements ILeaferCanvas {
166
166
  if (childOptions) {
167
167
  if (childOptions.strokeCap) strokeCap = childOptions.strokeCap
168
168
  if (childOptions.strokeJoin) strokeJoin = childOptions.strokeJoin
169
- if (childOptions.dashPattern !== undefined) dashPattern = childOptions.dashPattern
170
- if (childOptions.dashOffset !== undefined) dashOffset = childOptions.dashOffset
169
+ if (!isUndefined(childOptions.dashPattern)) dashPattern = childOptions.dashPattern
170
+ if (!isUndefined(childOptions.dashOffset)) dashOffset = childOptions.dashOffset
171
171
  if (childOptions.miterLimit) miterLimit = childOptions.miterLimit
172
172
  }
173
173
  this.strokeCap = strokeCap