@leafer/canvas-web 1.0.0-alpha.6 → 1.0.0-alpha.9
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 +5 -5
- package/src/CanvasBase.ts +4 -4
- package/src/LeaferCanvas.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas-web",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "@leafer/canvas-web",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/math": "1.0.0-alpha.
|
|
23
|
-
"@leafer/event": "1.0.0-alpha.
|
|
24
|
-
"@leafer/debug": "1.0.0-alpha.
|
|
22
|
+
"@leafer/math": "1.0.0-alpha.9",
|
|
23
|
+
"@leafer/event": "1.0.0-alpha.9",
|
|
24
|
+
"@leafer/debug": "1.0.0-alpha.9"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@leafer/interface": "1.0.0-alpha.
|
|
27
|
+
"@leafer/interface": "1.0.0-alpha.9"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/CanvasBase.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICanvasAttr,
|
|
1
|
+
import { ICanvasAttr, ITextMetrics, ICanvasContext2D, IPath2D, IObject, InnerId, IMatrixData, IFunction, IWindingRule } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function contextAttr(realName?: string) {
|
|
@@ -29,7 +29,7 @@ export class CanvasBase {
|
|
|
29
29
|
|
|
30
30
|
public __: ICanvasAttr
|
|
31
31
|
|
|
32
|
-
public context:
|
|
32
|
+
public context: ICanvasContext2D
|
|
33
33
|
|
|
34
34
|
// canvas attr
|
|
35
35
|
|
|
@@ -157,13 +157,13 @@ export class CanvasBase {
|
|
|
157
157
|
public rotate(_angle: number): void { }
|
|
158
158
|
|
|
159
159
|
@contextMethod()
|
|
160
|
-
public fill(_path2d?: IPath2D |
|
|
160
|
+
public fill(_path2d?: IPath2D | IWindingRule, _rule?: IWindingRule): void { }
|
|
161
161
|
|
|
162
162
|
@contextMethod()
|
|
163
163
|
public stroke(_path2d?: IPath2D): void { }
|
|
164
164
|
|
|
165
165
|
@contextMethod()
|
|
166
|
-
public clip(_path2d?: IPath2D |
|
|
166
|
+
public clip(_path2d?: IPath2D | IWindingRule, _rule?: IWindingRule): void { }
|
|
167
167
|
|
|
168
168
|
@contextMethod()
|
|
169
169
|
public fillRect(_x: number, _y: number, _width: number, _height: number): void { }
|
package/src/LeaferCanvas.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBounds, ILeaferCanvas, ICanvasStrokeOptions,
|
|
1
|
+
import { IBounds, ILeaferCanvas, ICanvasStrokeOptions, ICanvasContext2D, ILeaferCanvasConfig, IMatrixData, IBoundsData, IAutoBounds, ISizeData, IScreenSizeData, IResizeEventListener, IMatrixWithBoundsData, IPointData, InnerId, ICanvasManager, IWindingRule } from '@leafer/interface'
|
|
2
2
|
import { Bounds, BoundsHelper, IncrementId } from '@leafer/math'
|
|
3
3
|
import { ResizeEvent } from '@leafer/event'
|
|
4
4
|
import { Debug } from '@leafer/debug'
|
|
@@ -72,7 +72,7 @@ export class LeaferCanvas extends CanvasBase implements ILeaferCanvas {
|
|
|
72
72
|
this.pixelRatio = config.pixelRatio
|
|
73
73
|
|
|
74
74
|
if (!config.webgl) {
|
|
75
|
-
this.context = this.view.getContext('2d') as
|
|
75
|
+
this.context = this.view.getContext('2d') as ICanvasContext2D
|
|
76
76
|
this.smooth = true
|
|
77
77
|
if (config.fill) this.view.style.backgroundColor = config.fill
|
|
78
78
|
if (config.width && config.height) this.resize(config as IScreenSizeData)
|
|
@@ -215,7 +215,7 @@ export class LeaferCanvas extends CanvasBase implements ILeaferCanvas {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
|
|
218
|
-
public hitPath(point: IPointData, fillRule?:
|
|
218
|
+
public hitPath(point: IPointData, fillRule?: IWindingRule): boolean {
|
|
219
219
|
return this.context.isPointInPath(point.x, point.y, fillRule)
|
|
220
220
|
}
|
|
221
221
|
|