@leafer/canvas 1.8.0 → 1.9.1
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 +9 -9
- package/src/Canvas.ts +3 -1
- package/src/LeaferCanvasBase.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
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.
|
|
26
|
-
"@leafer/list": "1.
|
|
27
|
-
"@leafer/math": "1.
|
|
28
|
-
"@leafer/data": "1.
|
|
29
|
-
"@leafer/path": "1.
|
|
30
|
-
"@leafer/debug": "1.
|
|
31
|
-
"@leafer/platform": "1.
|
|
25
|
+
"@leafer/file": "1.9.1",
|
|
26
|
+
"@leafer/list": "1.9.1",
|
|
27
|
+
"@leafer/math": "1.9.1",
|
|
28
|
+
"@leafer/data": "1.9.1",
|
|
29
|
+
"@leafer/path": "1.9.1",
|
|
30
|
+
"@leafer/debug": "1.9.1",
|
|
31
|
+
"@leafer/platform": "1.9.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@leafer/interface": "1.
|
|
34
|
+
"@leafer/interface": "1.9.1"
|
|
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 (
|
|
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)
|
package/src/LeaferCanvasBase.ts
CHANGED
|
@@ -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
|
|
|
@@ -61,7 +61,7 @@ export class LeaferCanvasBase extends Canvas implements ILeaferCanvas {
|
|
|
61
61
|
const { width, height, pixelRatio } = config
|
|
62
62
|
this.autoLayout = !width || !height
|
|
63
63
|
|
|
64
|
-
this.size.pixelRatio = pixelRatio
|
|
64
|
+
this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio
|
|
65
65
|
this.config = config
|
|
66
66
|
|
|
67
67
|
this.init()
|
|
@@ -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
|
|
170
|
-
if (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
|