@leafer/interface 1.0.0-alpha.7 → 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
CHANGED
package/src/canvas/ICanvas.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type GlobalCompositeOperation = 'color' | 'color-burn' | 'color-dodge' | 'copy' | 'darken' | 'destination-atop' | 'destination-in' | 'destination-out' | 'destination-over' | 'difference' | 'exclusion' | 'hard-light' | 'hue' | 'lighten' | 'lighter' | 'luminosity' | 'multiply' | 'overlay' | 'saturation' | 'screen' | 'soft-light' | 'source-atop' | 'source-in' | 'source-out' | 'source-over' | 'xor'
|
|
2
2
|
type CanvasDirection = 'inherit' | 'ltr' | 'rtl'
|
|
3
|
-
export type
|
|
3
|
+
export type IWindingRule = 'evenodd' | 'nonzero'
|
|
4
4
|
// type CanvasFontKerning = 'auto' | 'none' | 'normal'
|
|
5
5
|
// type CanvasFontStretch = 'condensed' | 'expanded' | 'extra-condensed' | 'extra-expanded' | 'normal' | 'semi-condensed' | 'semi-expanded' | 'ultra-condensed' | 'ultra-expanded'
|
|
6
6
|
// type CanvasFontVariantCaps = 'all-petite-caps' | 'all-small-caps' | 'normal' | 'petite-caps' | 'small-caps' | 'titling-caps' | 'unicase'
|
|
@@ -35,12 +35,12 @@ interface CanvasDrawImage {
|
|
|
35
35
|
|
|
36
36
|
interface CanvasDrawPath {
|
|
37
37
|
beginPath(): void
|
|
38
|
-
clip(fillRule?:
|
|
39
|
-
clip(path: IPath2D, fillRule?:
|
|
40
|
-
fill(fillRule?:
|
|
41
|
-
fill(path: IPath2D, fillRule?:
|
|
42
|
-
isPointInPath(x: number, y: number, fillRule?:
|
|
43
|
-
isPointInPath(path: IPath2D, x: number, y: number, fillRule?:
|
|
38
|
+
clip(fillRule?: IWindingRule): void
|
|
39
|
+
clip(path: IPath2D, fillRule?: IWindingRule): void
|
|
40
|
+
fill(fillRule?: IWindingRule): void
|
|
41
|
+
fill(path: IPath2D, fillRule?: IWindingRule): void
|
|
42
|
+
isPointInPath(x: number, y: number, fillRule?: IWindingRule): boolean
|
|
43
|
+
isPointInPath(path: IPath2D, x: number, y: number, fillRule?: IWindingRule): boolean
|
|
44
44
|
isPointInStroke(x: number, y: number): boolean
|
|
45
45
|
isPointInStroke(path: IPath2D, x: number, y: number): boolean
|
|
46
46
|
stroke(): void
|
|
@@ -137,14 +137,14 @@ interface CanvasRenderingContext2DSettings {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a <canvas> element. It is used for drawing shapes, text, images, and other objects. */
|
|
140
|
-
export interface
|
|
140
|
+
export interface ICanvasContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface {
|
|
141
141
|
readonly canvas: HTMLCanvasElement
|
|
142
142
|
getContextAttributes(): CanvasRenderingContext2DSettings
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
declare var
|
|
146
|
-
prototype:
|
|
147
|
-
new():
|
|
145
|
+
declare var ICanvasContext2D: {
|
|
146
|
+
prototype: ICanvasContext2D
|
|
147
|
+
new(): ICanvasContext2D
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
interface CanvasShadowStyles {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { IObject } from '../data/IData'
|
|
2
2
|
import { IBounds, IMatrixData, IBoundsData, IAutoBoundsData, IAutoBounds, IScreenSizeData, IMatrixWithBoundsData, IPointData } from '../math/IMath'
|
|
3
|
-
import {
|
|
3
|
+
import { ICanvasContext2D, IWindingRule, IPath2D, ITextMetrics, CanvasGradient, CanvasPattern } from './ICanvas'
|
|
4
4
|
import { IResizeEventListener } from '../event/IEvent'
|
|
5
|
-
import {
|
|
5
|
+
import { IPathDrawer } from '../path/IPathDrawer'
|
|
6
6
|
import { InnerId } from '../event/IEventer'
|
|
7
7
|
import { ICanvasManager } from './ICanvasManager'
|
|
8
8
|
|
|
9
|
-
export interface ILeaferCanvasContext extends ICanvasRenderingContext2D {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
14
10
|
view?: string | IObject
|
|
15
11
|
fill?: string
|
|
@@ -67,9 +63,9 @@ interface ICanvasMethod {
|
|
|
67
63
|
save(): void
|
|
68
64
|
restore(): void
|
|
69
65
|
|
|
70
|
-
fill(path?: IPath2D |
|
|
66
|
+
fill(path?: IPath2D | IWindingRule, rule?: IWindingRule): void
|
|
71
67
|
stroke(path?: IPath2D): void
|
|
72
|
-
clip(path?: IPath2D |
|
|
68
|
+
clip(path?: IPath2D | IWindingRule, rule?: IWindingRule): void
|
|
73
69
|
|
|
74
70
|
fillRect(x: number, y: number, width: number, height: number): void
|
|
75
71
|
strokeRect(x: number, y: number, width: number, height: number): void
|
|
@@ -121,7 +117,7 @@ interface ICanvasMethod {
|
|
|
121
117
|
clear(): void
|
|
122
118
|
}
|
|
123
119
|
|
|
124
|
-
export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod,
|
|
120
|
+
export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
125
121
|
|
|
126
122
|
manager: ICanvasManager
|
|
127
123
|
|
|
@@ -137,7 +133,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, ICanvasDrawPa
|
|
|
137
133
|
bounds: IBounds
|
|
138
134
|
|
|
139
135
|
view: unknown
|
|
140
|
-
context:
|
|
136
|
+
context: ICanvasContext2D
|
|
141
137
|
|
|
142
138
|
recycled?: boolean
|
|
143
139
|
|
package/src/index.ts
CHANGED
|
@@ -29,9 +29,9 @@ export { IPlatform } from './platform/IPlatform'
|
|
|
29
29
|
export { IPlugin } from './plugin/IPlugin'
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions,
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
32
|
+
export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
|
|
33
|
+
export { IPathDrawer } from './path/IPathDrawer'
|
|
34
|
+
export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
|
|
35
35
|
export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
|
|
36
36
|
|
|
37
37
|
export { ILeaferImage, ILeaferImageConfig } from './image/ILeaferImage'
|