@leafer/canvas 1.6.3 → 1.6.5
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/LeaferCanvasBase.ts +10 -6
- package/types/index.d.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/canvas",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
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.6.
|
|
26
|
-
"@leafer/list": "1.6.
|
|
27
|
-
"@leafer/math": "1.6.
|
|
28
|
-
"@leafer/data": "1.6.
|
|
29
|
-
"@leafer/path": "1.6.
|
|
30
|
-
"@leafer/debug": "1.6.
|
|
31
|
-
"@leafer/platform": "1.6.
|
|
25
|
+
"@leafer/file": "1.6.5",
|
|
26
|
+
"@leafer/list": "1.6.5",
|
|
27
|
+
"@leafer/math": "1.6.5",
|
|
28
|
+
"@leafer/data": "1.6.5",
|
|
29
|
+
"@leafer/path": "1.6.5",
|
|
30
|
+
"@leafer/debug": "1.6.5",
|
|
31
|
+
"@leafer/platform": "1.6.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@leafer/interface": "1.6.
|
|
34
|
+
"@leafer/interface": "1.6.5"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/LeaferCanvasBase.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBounds, ILeaferCanvas, ICanvasStrokeOptions, ILeaferCanvasConfig, IExportOptions, IMatrixData, IBoundsData, IAutoBounds, IScreenSizeData, IResizeEventListener, IMatrixWithBoundsData, IPointData, InnerId, ICanvasManager, IWindingRule, IBlendMode, IExportImageType, IExportFileType, IBlob, ICursorType, ILeaferCanvasView, IRadiusPointData, IObject, IMatrixWithOptionHalfData } from '@leafer/interface'
|
|
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
4
|
import { DataHelper } from '@leafer/data'
|
|
@@ -272,11 +272,6 @@ export class LeaferCanvasBase extends Canvas implements ILeaferCanvas {
|
|
|
272
272
|
if (blendMode) this.blendMode = 'source-over'
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
public clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void {
|
|
276
|
-
this.setTempBounds(bounds, ceilPixel)
|
|
277
|
-
this.clearRect(tempBounds.x, tempBounds.y, tempBounds.width, tempBounds.height)
|
|
278
|
-
}
|
|
279
|
-
|
|
280
275
|
public clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void {
|
|
281
276
|
this.beginPath()
|
|
282
277
|
this.setTempBounds(bounds, ceilPixel)
|
|
@@ -285,6 +280,15 @@ export class LeaferCanvasBase extends Canvas implements ILeaferCanvas {
|
|
|
285
280
|
|
|
286
281
|
}
|
|
287
282
|
|
|
283
|
+
public clipUI(ruleData: IWindingRuleData): void {
|
|
284
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip()
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
public clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void {
|
|
288
|
+
this.setTempBounds(bounds, ceilPixel)
|
|
289
|
+
this.clearRect(tempBounds.x, tempBounds.y, tempBounds.width, tempBounds.height)
|
|
290
|
+
}
|
|
291
|
+
|
|
288
292
|
public clear(): void {
|
|
289
293
|
const { pixelRatio } = this
|
|
290
294
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2)
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICanvasManager, ILeaferCanvas, IScreenSizeData, ICanvasAttr, InnerId, ICanvasContext2D, IBlendMode, IMatrixData, IPath2D, IWindingRule, ITextMetrics, IBounds, IBoundsData, ILeaferCanvasConfig, ILeaferCanvasView, IExportFileType, IExportOptions, IBlob, IExportImageType, IAutoBounds, IResizeEventListener, ICursorType, IMatrixWithOptionHalfData, ICanvasStrokeOptions, IPointData, IRadiusPointData, IMatrixWithBoundsData, IPathDrawer } from '@leafer/interface';
|
|
1
|
+
import { ICanvasManager, ILeaferCanvas, IScreenSizeData, ICanvasAttr, InnerId, ICanvasContext2D, IBlendMode, IMatrixData, IPath2D, IWindingRule, ITextMetrics, IBounds, IBoundsData, ILeaferCanvasConfig, ILeaferCanvasView, IExportFileType, IExportOptions, IBlob, IExportImageType, IAutoBounds, IResizeEventListener, ICursorType, IMatrixWithOptionHalfData, ICanvasStrokeOptions, IPointData, IRadiusPointData, IMatrixWithBoundsData, IWindingRuleData, IPathDrawer } from '@leafer/interface';
|
|
2
2
|
|
|
3
3
|
declare class CanvasManager implements ICanvasManager {
|
|
4
4
|
list: ILeaferCanvas[];
|
|
@@ -137,8 +137,9 @@ declare class LeaferCanvasBase extends Canvas implements ILeaferCanvas {
|
|
|
137
137
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
138
138
|
fillWorld(bounds: IBoundsData, color: string | object, blendMode?: IBlendMode): void;
|
|
139
139
|
strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: IBlendMode): void;
|
|
140
|
-
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
141
140
|
clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
141
|
+
clipUI(ruleData: IWindingRuleData): void;
|
|
142
|
+
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
142
143
|
clear(): void;
|
|
143
144
|
protected setTempBounds(bounds: IBoundsData, ceil?: boolean, intersect?: boolean): void;
|
|
144
145
|
isSameSize(size: IScreenSizeData): boolean;
|