@leapfrog/interactive-canvas 2.0.8 → 2.0.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/dist/abstract-interactive-canvas.d.ts +372 -0
- package/dist/dimensions/millimeter-dimensions.d.ts +15 -0
- package/dist/dimensions/pixel-canvas-dimensions.d.ts +13 -0
- package/dist/dimensions/print-6-col-canvas-dimensions.d.ts +18 -0
- package/dist/dimensions/print-8-col-canvas-dimensions.d.ts +18 -0
- package/dist/font/font-library.d.ts +27 -0
- package/dist/font/font-library.interface.d.ts +24 -0
- package/dist/font/font.interface.d.ts +20 -0
- package/dist/font/unknown-font.d.ts +6 -0
- package/dist/headless-interactive-canvas.d.ts +10 -0
- package/dist/index.d.ts +54 -0
- package/dist/interactive-canvas.d.ts +25 -0
- package/dist/interactive-canvas.es.js +3995 -0
- package/dist/interactive-canvas.interface.d.ts +297 -0
- package/dist/interactive-canvas.js +4028 -0
- package/dist/layout/abstract-layout-manager.d.ts +17 -0
- package/dist/layout/advanced-layout-manager.d.ts +16 -0
- package/dist/layout/function/pin-to-bottom.layout-function.d.ts +4 -0
- package/dist/layout/function/redraw-all.layout-function.d.ts +4 -0
- package/dist/layout/function/reposition-backgrounds.layout-function.d.ts +4 -0
- package/dist/layout/function/reposition-borders.layout-function.d.ts +4 -0
- package/dist/layout/function/reposition-cutoffs.layout-function.d.ts +4 -0
- package/dist/layout/function/resize-canvas.layout-function.d.ts +4 -0
- package/dist/layout/function/stack-objects.layout-function.d.ts +11 -0
- package/dist/layout/function/update-object-dimensions.layout-function.d.ts +4 -0
- package/dist/layout/layout-manager.enum.d.ts +5 -0
- package/dist/layout/layout-manager.interface.d.ts +13 -0
- package/dist/layout/standard-layout-manager.d.ts +40 -0
- package/dist/mutator/mutable-background-color.interface.d.ts +15 -0
- package/dist/mutator/mutable-color.interface.d.ts +6 -0
- package/dist/mutator/mutable-image.interface.d.ts +28 -0
- package/dist/mutator/mutable-position.interface.d.ts +63 -0
- package/dist/mutator/mutable-stroke.interface.d.ts +8 -0
- package/dist/mutator/mutable-text-style.interface.d.ts +163 -0
- package/dist/mutator/mutable-text.interface.d.ts +80 -0
- package/dist/object/abstract-canvas-object.d.ts +207 -0
- package/dist/object/canvas-object-data.d.ts +24 -0
- package/dist/object/canvas-object.interface.d.ts +109 -0
- package/dist/object/impl/background-image.d.ts +38 -0
- package/dist/object/impl/border.d.ts +70 -0
- package/dist/object/impl/cutoff.d.ts +59 -0
- package/dist/object/impl/extended-fabric-object.interface.d.ts +7 -0
- package/dist/object/impl/extended-fabric-textbox.interface.d.ts +7 -0
- package/dist/object/impl/horizontal-rule.d.ts +83 -0
- package/dist/object/impl/image.d.ts +76 -0
- package/dist/object/impl/rectangle.d.ts +78 -0
- package/dist/object/impl/rich-text.d.ts +39 -0
- package/dist/object/impl/text.d.ts +314 -0
- package/dist/object/impl/vertical-rule.d.ts +83 -0
- package/dist/profile/canvas-profile.interface.d.ts +22 -0
- package/dist/profile/default-canvas-profile.d.ts +23 -0
- package/dist/types/canvas-dimension-restrictions.interface.d.ts +15 -0
- package/dist/types/canvas-dimensions.interface.d.ts +21 -0
- package/dist/types/canvas-state.interface.d.ts +11 -0
- package/dist/types/dimension-restrictions.interface.d.ts +6 -0
- package/dist/types/image-type.enum.d.ts +6 -0
- package/dist/types/margin.interface.d.ts +6 -0
- package/dist/types/object-dimensions.interface.d.ts +23 -0
- package/dist/types/object-type.enum.d.ts +12 -0
- package/dist/types/overflow.interface.d.ts +4 -0
- package/dist/types/position.interface.d.ts +9 -0
- package/dist/types/rect.interface.d.ts +6 -0
- package/dist/types/selection-data.interface.d.ts +19 -0
- package/dist/types/text-alignment.interface.d.ts +1 -0
- package/dist/undo-stack.d.ts +27 -0
- package/dist/undo-stack.interface.d.ts +6 -0
- package/package.json +30 -30
- package/readme.md +60 -60
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ICanvasObject } from "../canvas-object.interface";
|
|
2
|
+
import { IInteractiveCanvas, IMutableColor, IMutablePosition, IMutableStroke } from "../..";
|
|
3
|
+
import { AbstractCanvasObject } from "../abstract-canvas-object";
|
|
4
|
+
import { CanvasObjectData } from "../canvas-object-data";
|
|
5
|
+
import { fabric } from "fabric";
|
|
6
|
+
/**
|
|
7
|
+
* Rectangle field. A basic block of color that can be moved and scaled.
|
|
8
|
+
*/
|
|
9
|
+
export interface IRectangle extends ICanvasObject, IMutableStroke, IMutableColor, IMutablePosition {
|
|
10
|
+
}
|
|
11
|
+
export declare class Rectangle extends AbstractCanvasObject<fabric.Rect> implements IRectangle {
|
|
12
|
+
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
|
|
13
|
+
/**
|
|
14
|
+
* @override
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
getColor(): string;
|
|
18
|
+
/**
|
|
19
|
+
* @override
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
setColor(color: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* @override
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
getStrokeColor(): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* @override
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
setStrokeColor(color: string | null): void;
|
|
33
|
+
/**
|
|
34
|
+
* @override
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
getStrokeWidth(): number;
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
setStrokeWidth(width: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* @override
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
centerHorizontally(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
centerVertically(): void;
|
|
53
|
+
/**
|
|
54
|
+
* @override
|
|
55
|
+
* @inheritDoc
|
|
56
|
+
*/
|
|
57
|
+
nudgeUp(): void;
|
|
58
|
+
/**
|
|
59
|
+
* @override
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
nudgeDown(): void;
|
|
63
|
+
/**
|
|
64
|
+
* @override
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
nudgeLeft(): void;
|
|
68
|
+
/**
|
|
69
|
+
* @override
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
nudgeRight(): void;
|
|
73
|
+
/**
|
|
74
|
+
* @override
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/
|
|
77
|
+
protected afterScale(event: any): void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CanvasObjectData, IInteractiveCanvas, Image, IMutableImage, IMutablePosition } from "../..";
|
|
2
|
+
import { ICanvasObject } from "../canvas-object.interface";
|
|
3
|
+
import { fabric } from "fabric";
|
|
4
|
+
/**
|
|
5
|
+
* Rich text field.
|
|
6
|
+
* Displays complex text by taking a rendered image of a html block of rich text and displays it on the canvas.
|
|
7
|
+
* The rendering of the text content to an image must be handled by the caller.
|
|
8
|
+
* This is an attempt to work around the poor rich-text support of fabric, which supports virtually no rich-text features on the canvas itself.
|
|
9
|
+
*/
|
|
10
|
+
export interface IRichText extends ICanvasObject, IMutableImage, IMutablePosition {
|
|
11
|
+
/**
|
|
12
|
+
* HTML rich text content.
|
|
13
|
+
*/
|
|
14
|
+
htmlContent: string;
|
|
15
|
+
/**
|
|
16
|
+
* Set the rich text content by providing the rendered image version of the content and the html content.
|
|
17
|
+
* @param renderedContentUrl Rendered version of the rich-text content.
|
|
18
|
+
* @param htmlContent Html version of the rich text content.
|
|
19
|
+
*/
|
|
20
|
+
setRichTextContent(renderedContentUrl: string, htmlContent: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare class RichText extends Image implements IRichText {
|
|
23
|
+
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Image, persistedField?: CanvasObjectData);
|
|
24
|
+
/**
|
|
25
|
+
* @override
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
get htmlContent(): string;
|
|
29
|
+
/**
|
|
30
|
+
* @override
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
set htmlContent(text: string);
|
|
34
|
+
/**
|
|
35
|
+
* @override
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
setRichTextContent(renderedContentUrl: string, htmlContent: string): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { IFont, IInteractiveCanvas, IMutableBackgroundColor, IMutableColor, IMutablePosition, IMutableText, IMutableTextStyle, ITextSelection, TextAlignment } from "../..";
|
|
3
|
+
import { ICanvasObject } from "../canvas-object.interface";
|
|
4
|
+
import { AbstractCanvasObject } from "../abstract-canvas-object";
|
|
5
|
+
import { CanvasObjectData } from "../canvas-object-data";
|
|
6
|
+
import { fabric } from "fabric";
|
|
7
|
+
import { ExtendedFabricTextbox } from "./extended-fabric-textbox.interface";
|
|
8
|
+
/**
|
|
9
|
+
* Text field. Displays customizable text.
|
|
10
|
+
*/
|
|
11
|
+
export interface IText extends ICanvasObject, IMutableColor, IMutableText, IMutableTextStyle, IMutablePosition, IMutableBackgroundColor {
|
|
12
|
+
/**
|
|
13
|
+
* @return Whether this text object should resize the canvas.
|
|
14
|
+
*/
|
|
15
|
+
isResizeCanvas(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Set whether this text object should resize the canvas.
|
|
18
|
+
*/
|
|
19
|
+
setResizeCanvas(value: boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
* Focus input on the text object.
|
|
22
|
+
*/
|
|
23
|
+
focus(): void;
|
|
24
|
+
/**
|
|
25
|
+
* @return Is the text box currently being edited.
|
|
26
|
+
*/
|
|
27
|
+
isEditing(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Start editing the text.
|
|
30
|
+
*/
|
|
31
|
+
enterEditing(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Select all text.
|
|
34
|
+
*/
|
|
35
|
+
selectAllText(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Set the prefill type used for this text field.
|
|
38
|
+
*/
|
|
39
|
+
setPrefillType(prefillType: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get the prefill type used for this text field.
|
|
42
|
+
*/
|
|
43
|
+
getPrefillType(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Return the margin needed for bullets on this object.
|
|
46
|
+
*/
|
|
47
|
+
getBulletMargin(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Return the margin needed for ordered lists on this object.
|
|
50
|
+
*/
|
|
51
|
+
getOrderedListMargin(): number;
|
|
52
|
+
}
|
|
53
|
+
export declare class Text extends AbstractCanvasObject<ExtendedFabricTextbox> implements IText {
|
|
54
|
+
private readonly fontLibrary;
|
|
55
|
+
private baseComponentHeight;
|
|
56
|
+
private readonly text$;
|
|
57
|
+
private readonly textSelection$;
|
|
58
|
+
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Textbox, persistedField?: CanvasObjectData);
|
|
59
|
+
/**
|
|
60
|
+
* @override
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
getText(): string;
|
|
64
|
+
/**
|
|
65
|
+
* @override
|
|
66
|
+
* @inheritDoc
|
|
67
|
+
*/
|
|
68
|
+
getText$(): Observable<string>;
|
|
69
|
+
/**
|
|
70
|
+
* @override
|
|
71
|
+
* @inheritDoc
|
|
72
|
+
*/
|
|
73
|
+
setText(text: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* @override
|
|
76
|
+
* @inheritDoc
|
|
77
|
+
*/
|
|
78
|
+
replaceText(target: string, replacement: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* @override
|
|
81
|
+
* @inheritDoc
|
|
82
|
+
*/
|
|
83
|
+
insertText(text: string, style?: any[], start?: number, end?: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* @override
|
|
86
|
+
* @inheritDoc
|
|
87
|
+
*/
|
|
88
|
+
insertTextAtSelection(text: string, style?: any[]): void;
|
|
89
|
+
/**
|
|
90
|
+
* @override
|
|
91
|
+
* @inheritDoc
|
|
92
|
+
*/
|
|
93
|
+
getColor(): string;
|
|
94
|
+
/**
|
|
95
|
+
* @override
|
|
96
|
+
* @inheritDoc
|
|
97
|
+
*/
|
|
98
|
+
setColor(color: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* @override
|
|
101
|
+
* @inheritDoc
|
|
102
|
+
*/
|
|
103
|
+
getTextSelection(): ITextSelection;
|
|
104
|
+
/**
|
|
105
|
+
* @override
|
|
106
|
+
* @inheritDoc
|
|
107
|
+
*/
|
|
108
|
+
getTextSelection$(): Observable<ITextSelection>;
|
|
109
|
+
/**
|
|
110
|
+
* @override
|
|
111
|
+
* @inheritDoc
|
|
112
|
+
*/
|
|
113
|
+
setTextAlign(alignment: TextAlignment): void;
|
|
114
|
+
/**
|
|
115
|
+
* @override
|
|
116
|
+
* @inheritDoc
|
|
117
|
+
*/
|
|
118
|
+
setCharSpacing(spacing: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* @override
|
|
121
|
+
* @inheritDoc
|
|
122
|
+
*/
|
|
123
|
+
setLineHeight(height: number): void;
|
|
124
|
+
/**
|
|
125
|
+
* @override
|
|
126
|
+
* @inheritDoc
|
|
127
|
+
*/
|
|
128
|
+
setBold(bold?: boolean): void;
|
|
129
|
+
/**
|
|
130
|
+
* @override
|
|
131
|
+
* @inheritDoc
|
|
132
|
+
*/
|
|
133
|
+
setBoldRegion(start: number, end: number, bold?: boolean): void;
|
|
134
|
+
/**
|
|
135
|
+
* @override
|
|
136
|
+
* @inheritDoc
|
|
137
|
+
*/
|
|
138
|
+
setItalic(italic?: boolean): void;
|
|
139
|
+
/**
|
|
140
|
+
* @override
|
|
141
|
+
* @inheritDoc
|
|
142
|
+
*/
|
|
143
|
+
setItalicRegion(start: number, end: number, italic?: boolean): void;
|
|
144
|
+
/**
|
|
145
|
+
* @override
|
|
146
|
+
* @inheritDoc
|
|
147
|
+
*/
|
|
148
|
+
setStrikethrough(strikethrough?: boolean): void;
|
|
149
|
+
/**
|
|
150
|
+
* @override
|
|
151
|
+
* @inheritDoc
|
|
152
|
+
*/
|
|
153
|
+
setUnderline(underline?: boolean): void;
|
|
154
|
+
/**
|
|
155
|
+
* @override
|
|
156
|
+
* @inheritDoc
|
|
157
|
+
*/
|
|
158
|
+
setFont(font: IFont): void;
|
|
159
|
+
/**
|
|
160
|
+
* @override
|
|
161
|
+
* @inheritDoc
|
|
162
|
+
*/
|
|
163
|
+
setFontSize(fontSize: number): void;
|
|
164
|
+
/**
|
|
165
|
+
* @override
|
|
166
|
+
* @inheritDoc
|
|
167
|
+
*/
|
|
168
|
+
setTextBackgroundColor(color: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* @override
|
|
171
|
+
* @inheritDoc
|
|
172
|
+
*/
|
|
173
|
+
centerHorizontally(): void;
|
|
174
|
+
/**
|
|
175
|
+
* @override
|
|
176
|
+
* @inheritDoc
|
|
177
|
+
*/
|
|
178
|
+
centerVertically(): void;
|
|
179
|
+
/**
|
|
180
|
+
* @override
|
|
181
|
+
* @inheritDoc
|
|
182
|
+
*/
|
|
183
|
+
nudgeUp(): void;
|
|
184
|
+
/**
|
|
185
|
+
* @override
|
|
186
|
+
* @inheritDoc
|
|
187
|
+
*/
|
|
188
|
+
nudgeDown(): void;
|
|
189
|
+
/**
|
|
190
|
+
* @override
|
|
191
|
+
* @inheritDoc
|
|
192
|
+
*/
|
|
193
|
+
nudgeLeft(): void;
|
|
194
|
+
/**
|
|
195
|
+
* @override
|
|
196
|
+
* @inheritDoc
|
|
197
|
+
*/
|
|
198
|
+
nudgeRight(): void;
|
|
199
|
+
/**
|
|
200
|
+
* @override
|
|
201
|
+
* @inheritDoc
|
|
202
|
+
*/
|
|
203
|
+
getBackgroundColor(): string;
|
|
204
|
+
/**
|
|
205
|
+
* @override
|
|
206
|
+
* @inheritDoc
|
|
207
|
+
*/
|
|
208
|
+
setBackgroundColor(color: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* @override
|
|
211
|
+
* @inheritDoc
|
|
212
|
+
*/
|
|
213
|
+
setPrefillType(prefillType: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* @override
|
|
216
|
+
* @inheritDoc
|
|
217
|
+
*/
|
|
218
|
+
getPrefillType(): string;
|
|
219
|
+
/**
|
|
220
|
+
* @override
|
|
221
|
+
* @inheritDoc
|
|
222
|
+
*/
|
|
223
|
+
getBulletMargin(): number;
|
|
224
|
+
/**
|
|
225
|
+
* @override
|
|
226
|
+
* @inheritDoc
|
|
227
|
+
*/
|
|
228
|
+
getOrderedListMargin(): number;
|
|
229
|
+
/**
|
|
230
|
+
* @override
|
|
231
|
+
* @inheritDoc
|
|
232
|
+
*/
|
|
233
|
+
isResizeCanvas(): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* @override
|
|
236
|
+
* @inheritDoc
|
|
237
|
+
*/
|
|
238
|
+
setResizeCanvas(value: boolean): void;
|
|
239
|
+
/**
|
|
240
|
+
* @override
|
|
241
|
+
* @inheritDoc
|
|
242
|
+
*/
|
|
243
|
+
focus(): void;
|
|
244
|
+
/**
|
|
245
|
+
* @override
|
|
246
|
+
* @inheritDoc
|
|
247
|
+
*/
|
|
248
|
+
isEditing(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* @override
|
|
251
|
+
* @inheritDoc
|
|
252
|
+
*/
|
|
253
|
+
enterEditing(): void;
|
|
254
|
+
/**
|
|
255
|
+
* @override
|
|
256
|
+
* @inheritDoc
|
|
257
|
+
*/
|
|
258
|
+
selectAllText(): void;
|
|
259
|
+
/**
|
|
260
|
+
* @override
|
|
261
|
+
* @inheritDoc
|
|
262
|
+
*/
|
|
263
|
+
isBulleted(): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* @override
|
|
266
|
+
* @inheritDoc
|
|
267
|
+
*/
|
|
268
|
+
enableBullets(): void;
|
|
269
|
+
/**
|
|
270
|
+
* @override
|
|
271
|
+
* @inheritDoc
|
|
272
|
+
*/
|
|
273
|
+
disableBullets(): void;
|
|
274
|
+
/**
|
|
275
|
+
* @override
|
|
276
|
+
* @inheritDoc
|
|
277
|
+
*/
|
|
278
|
+
isOrderedList(): boolean;
|
|
279
|
+
/**
|
|
280
|
+
* @override
|
|
281
|
+
* @inheritDoc
|
|
282
|
+
*/
|
|
283
|
+
enableOrderedList(): void;
|
|
284
|
+
/**
|
|
285
|
+
* @override
|
|
286
|
+
* @inheritDoc
|
|
287
|
+
*/
|
|
288
|
+
disableOrderedList(): void;
|
|
289
|
+
/**
|
|
290
|
+
* @override
|
|
291
|
+
* @inheritDoc
|
|
292
|
+
*/
|
|
293
|
+
setOrderedListStart(start: number): void;
|
|
294
|
+
/**
|
|
295
|
+
* @override
|
|
296
|
+
* @inheritDoc
|
|
297
|
+
*/
|
|
298
|
+
getOrderedListStart(): number;
|
|
299
|
+
getSizeIncreaseSinceCreation(): number;
|
|
300
|
+
private removeBullets;
|
|
301
|
+
private removeOrderedListMarkers;
|
|
302
|
+
private applyBulletListMonkeyPatches;
|
|
303
|
+
/**
|
|
304
|
+
* @override
|
|
305
|
+
* @inheritDoc
|
|
306
|
+
*/
|
|
307
|
+
protected updateFabricObjectBehavior(): void;
|
|
308
|
+
protected onTextChange(): void;
|
|
309
|
+
protected onDelete(): void;
|
|
310
|
+
protected onSelectionChange(): void;
|
|
311
|
+
private hasTextSelection;
|
|
312
|
+
private updateTextSelection;
|
|
313
|
+
private notifyCanvasOfTextChanges;
|
|
314
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { ICanvasObject } from "../canvas-object.interface";
|
|
3
|
+
import { IInteractiveCanvas, IMutableColor, IMutablePosition } from "../..";
|
|
4
|
+
import { AbstractCanvasObject } from "../abstract-canvas-object";
|
|
5
|
+
import { CanvasObjectData } from "../canvas-object-data";
|
|
6
|
+
import { fabric } from "fabric";
|
|
7
|
+
/**
|
|
8
|
+
* Vertical rule. A basic block of color that spans the canvas/row height.
|
|
9
|
+
*/
|
|
10
|
+
export interface IVerticalRule extends ICanvasObject, IMutableColor, IMutablePosition {
|
|
11
|
+
/**
|
|
12
|
+
* Get the width of the rule.
|
|
13
|
+
*/
|
|
14
|
+
getStrokeWidth(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Get an observable of the width of the rule.
|
|
17
|
+
*/
|
|
18
|
+
getStrokeWidth$(): Observable<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Set the rule width.
|
|
21
|
+
* @param width New width.
|
|
22
|
+
*/
|
|
23
|
+
setStrokeWidth(width: number): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class VerticalRule extends AbstractCanvasObject<fabric.Rect> implements IVerticalRule {
|
|
26
|
+
private readonly strokeWidth$;
|
|
27
|
+
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
|
|
28
|
+
/**
|
|
29
|
+
* @override
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
getStrokeWidth(): number;
|
|
33
|
+
/**
|
|
34
|
+
* @override
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
getStrokeWidth$(): Observable<number>;
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
setStrokeWidth(width: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* @override
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
getColor(): string;
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
setColor(color: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* @override
|
|
55
|
+
* @inheritDoc
|
|
56
|
+
*/
|
|
57
|
+
centerHorizontally(): void;
|
|
58
|
+
/**
|
|
59
|
+
* @override
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
centerVertically(): void;
|
|
63
|
+
/**
|
|
64
|
+
* @override
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
nudgeUp(): void;
|
|
68
|
+
/**
|
|
69
|
+
* @override
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
nudgeDown(): void;
|
|
73
|
+
/**
|
|
74
|
+
* @override
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/
|
|
77
|
+
nudgeLeft(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @override
|
|
80
|
+
* @inheritDoc
|
|
81
|
+
*/
|
|
82
|
+
nudgeRight(): void;
|
|
83
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextAlignment } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Defines the set of behaviors that can be adjusted on the interactive canvas, and provides an interface for grouping feature settings into a reusable profile.
|
|
4
|
+
*/
|
|
5
|
+
export interface ICanvasProfile {
|
|
6
|
+
readonly allowMultiSelect: boolean;
|
|
7
|
+
readonly allowObjectsToLeaveCanvas: boolean;
|
|
8
|
+
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
+
readonly allowMove: boolean;
|
|
10
|
+
readonly allowRotate: boolean;
|
|
11
|
+
readonly allowScale: boolean;
|
|
12
|
+
readonly defaultFont?: string;
|
|
13
|
+
readonly defaultFontSize: number;
|
|
14
|
+
readonly defaultFontColor: string;
|
|
15
|
+
readonly defaultLineHeight: number;
|
|
16
|
+
readonly defaultCharacterSpacing: number;
|
|
17
|
+
readonly defaultTextAlignment: TextAlignment;
|
|
18
|
+
readonly defaultBorderColor: string;
|
|
19
|
+
readonly defaultBorderWidth: number;
|
|
20
|
+
readonly defaultCutoffColor: string;
|
|
21
|
+
readonly defaultCutoffWidth: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextAlignment } from "..";
|
|
2
|
+
import { ICanvasProfile } from "./canvas-profile.interface";
|
|
3
|
+
/**
|
|
4
|
+
* Profile with as many features disabled as possible.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DefaultCanvasProfile implements ICanvasProfile {
|
|
7
|
+
readonly allowMultiSelect: boolean;
|
|
8
|
+
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
+
readonly allowObjectsToLeaveCanvas: boolean;
|
|
10
|
+
readonly allowMove: boolean;
|
|
11
|
+
readonly allowRotate: boolean;
|
|
12
|
+
readonly allowScale: boolean;
|
|
13
|
+
readonly defaultFont?: string;
|
|
14
|
+
readonly defaultFontSize: number;
|
|
15
|
+
readonly defaultFontColor: string;
|
|
16
|
+
readonly defaultLineHeight: number;
|
|
17
|
+
readonly defaultCharacterSpacing: number;
|
|
18
|
+
readonly defaultTextAlignment: TextAlignment;
|
|
19
|
+
readonly defaultBorderColor: string;
|
|
20
|
+
readonly defaultBorderWidth: number;
|
|
21
|
+
readonly defaultCutoffColor: string;
|
|
22
|
+
readonly defaultCutoffWidth: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ICanvasDimensionRestrictions {
|
|
2
|
+
readonly width?: {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
};
|
|
6
|
+
readonly height?: {
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
};
|
|
10
|
+
readonly volume?: {
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
};
|
|
14
|
+
readonly fixed?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ICanvasDimensions {
|
|
2
|
+
readonly width: number;
|
|
3
|
+
readonly widthPx: number;
|
|
4
|
+
readonly widthMm?: number;
|
|
5
|
+
readonly widthUnit: string;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
readonly heightPx: number;
|
|
8
|
+
readonly heightMm?: number;
|
|
9
|
+
readonly heightUnit: string;
|
|
10
|
+
withSize(width: number, height: number): ICanvasDimensions;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a number of pixels on the width to millimeters.
|
|
13
|
+
* @param px Pixel count.
|
|
14
|
+
*/
|
|
15
|
+
widthPxToMm(px: number): number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a number of pixels on the height to millimeters.
|
|
18
|
+
* @param px Pixel count.
|
|
19
|
+
*/
|
|
20
|
+
heightPxToMm(px: number): number | undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ICanvasDimensions } from "./canvas-dimensions.interface";
|
|
2
|
+
import { CanvasObjectData } from "..";
|
|
3
|
+
/**
|
|
4
|
+
* Serialized canvas state that can be used to save the canvas.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICanvasState {
|
|
7
|
+
readonly dimensions: ICanvasDimensions;
|
|
8
|
+
readonly canvasJson: string;
|
|
9
|
+
readonly objects: CanvasObjectData[];
|
|
10
|
+
readonly backgroundColor?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface IObjectDimensions {
|
|
2
|
+
readonly top: {
|
|
3
|
+
readonly px: number;
|
|
4
|
+
readonly mm: number;
|
|
5
|
+
};
|
|
6
|
+
readonly left: {
|
|
7
|
+
readonly px: number;
|
|
8
|
+
readonly mm: number;
|
|
9
|
+
};
|
|
10
|
+
readonly width: {
|
|
11
|
+
readonly px: number;
|
|
12
|
+
readonly mm: number;
|
|
13
|
+
};
|
|
14
|
+
readonly height: {
|
|
15
|
+
readonly px: number;
|
|
16
|
+
readonly mm: number;
|
|
17
|
+
};
|
|
18
|
+
readonly angle: number;
|
|
19
|
+
readonly scale: {
|
|
20
|
+
readonly x: number;
|
|
21
|
+
readonly y: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum ObjectType {
|
|
2
|
+
TEXT = "TEXT",
|
|
3
|
+
BORDER = "BORDER",
|
|
4
|
+
IMAGE = "IMAGE",
|
|
5
|
+
RECTANGLE = "RECTANGLE",
|
|
6
|
+
LIBRARY_IMAGE = "LIBRARY_IMAGE",
|
|
7
|
+
CUTOFF = "CUTOFF",
|
|
8
|
+
VERTICAL_RULE = "VERTICAL_RULE",
|
|
9
|
+
HORIZONTAL_RULE = "HORIZONTAL_RULE",
|
|
10
|
+
RICH_TEXT = "RICH_TEXT",
|
|
11
|
+
BACKGROUND_IMAGE = "BACKGROUND_IMAGE"
|
|
12
|
+
}
|