@leafer/path 1.0.1 → 1.0.2

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/path",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "@leafer/path",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,10 +22,10 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.0.1",
26
- "@leafer/debug": "1.0.1"
25
+ "@leafer/math": "1.0.2",
26
+ "@leafer/debug": "1.0.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.1"
29
+ "@leafer/interface": "1.0.2"
30
30
  }
31
31
  }
@@ -27,6 +27,7 @@ export class PathCreator implements IPathCreator { // tip: rewrited Pen
27
27
 
28
28
  public beginPath(): PathCreator {
29
29
  beginPath(this.__path)
30
+ this.paint()
30
31
  return this
31
32
  }
32
33
 
@@ -34,26 +35,31 @@ export class PathCreator implements IPathCreator { // tip: rewrited Pen
34
35
 
35
36
  public moveTo(x: number, y: number): PathCreator {
36
37
  moveTo(this.__path, x, y)
38
+ this.paint()
37
39
  return this
38
40
  }
39
41
 
40
42
  public lineTo(x: number, y: number): PathCreator {
41
43
  lineTo(this.__path, x, y)
44
+ this.paint()
42
45
  return this
43
46
  }
44
47
 
45
48
  public bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): PathCreator {
46
49
  bezierCurveTo(this.__path, x1, y1, x2, y2, x, y)
50
+ this.paint()
47
51
  return this
48
52
  }
49
53
 
50
54
  public quadraticCurveTo(x1: number, y1: number, x: number, y: number): PathCreator {
51
55
  quadraticCurveTo(this.__path, x1, y1, x, y)
56
+ this.paint()
52
57
  return this
53
58
  }
54
59
 
55
60
  public closePath(): PathCreator {
56
61
  closePath(this.__path)
62
+ this.paint()
57
63
  return this
58
64
  }
59
65
 
@@ -61,26 +67,31 @@ export class PathCreator implements IPathCreator { // tip: rewrited Pen
61
67
 
62
68
  public rect(x: number, y: number, width: number, height: number): PathCreator {
63
69
  rect(this.__path, x, y, width, height)
70
+ this.paint()
64
71
  return this
65
72
  }
66
73
 
67
74
  public roundRect(x: number, y: number, width: number, height: number, cornerRadius: number | number[]): PathCreator {
68
75
  roundRect(this.__path, x, y, width, height, cornerRadius)
76
+ this.paint()
69
77
  return this
70
78
  }
71
79
 
72
80
  public ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): PathCreator {
73
81
  ellipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)
82
+ this.paint()
74
83
  return this
75
84
  }
76
85
 
77
86
  public arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): PathCreator {
78
87
  arc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise)
88
+ this.paint()
79
89
  return this
80
90
  }
81
91
 
82
92
  public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): PathCreator {
83
93
  arcTo(this.__path, x1, y1, x2, y2, radius)
94
+ this.paint()
84
95
  return this
85
96
  }
86
97
 
@@ -88,19 +99,24 @@ export class PathCreator implements IPathCreator { // tip: rewrited Pen
88
99
 
89
100
  public drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): PathCreator {
90
101
  drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)
102
+ this.paint()
91
103
  return this
92
104
  }
93
105
 
94
106
  public drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): PathCreator {
95
107
  drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise)
108
+ this.paint()
96
109
  return this
97
110
  }
98
111
 
99
112
  public drawPoints(points: number[], curve?: boolean | number, close?: boolean): PathCreator {
100
113
  drawPoints(this.__path, points, curve, close)
114
+ this.paint()
101
115
  return this
102
116
  }
103
117
 
104
118
  public clearPath = this.beginPath
105
119
 
120
+ public paint(): void { }
121
+
106
122
  }
package/types/index.d.ts CHANGED
@@ -42,6 +42,7 @@ declare class PathCreator implements IPathCreator {
42
42
  drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): PathCreator;
43
43
  drawPoints(points: number[], curve?: boolean | number, close?: boolean): PathCreator;
44
44
  clearPath: () => PathCreator;
45
+ paint(): void;
45
46
  }
46
47
 
47
48
  declare const PathCommandDataHelper: {